如何遍歷Json對象?Jquery數組迭代json
var obj = { "field": {"row1" : {"col1":10,"col2":20,"col3":30},"row2" : {"col1":20,"col2":30,"col3":40}}}
$(obj).each(function(i,val) {
child_obj =val
while(children = child_obj.children()) {
child_obj = children .children()
}
});
當我在JSON對象上調用children函數時,它沒有得到孩子。
孩子們的功能是否僅適用於不在JSON上的DOM元素?
如何遍歷JSON對象並獲取列值?
那麼,是什麼在這裏實際上是這個問題? –
如何遍歷json對象並獲取col值 –
[Access/process(嵌套)對象,數組或JSON]可能的重複(http://stackoverflow.com/questions/11922383/access-process-nested-objects -arrays-or-json) – Sanoob