looping over a json object array with jquery

前端 未结 3 923
野的像风
野的像风 2020-12-18 12:30

Im trying to loop through a json files\' object array to access its variables\' keys and values and append them to list items using jquery\'s getjson and each.

I th

3条回答
  •  生来不讨喜
    2020-12-18 13:13

    $.getJSON('data/file.json', function(data){ 
        $.each(data,function(idx, obj){ 
            $.each(obj, function(key, value){
                console.log(key + ": " + value);
            });
        });
    });
    

提交回复
热议问题