javascript - How to decode json data to array value using jquery? -
i have below jsoncode
{"0":{"category":"screensets","position":"top","rotate":"180","3d_file":"3d_deg_180.obj","height":"10","width":"10","x":"299","y":"166","current_roate":"0","comp_color":""},"width":"640","height":"640","name":"test drawing","size":"40","screen":"conference set"}
how decode in array format using jquery?
small example may full
var j ='[{"id":"1","name":"test1"},{"id":"2","name":"test2"},{"id":"3","name":"test3"},{"id":"4","name":"test4"},{"id":"5","name":"test5"}]'; var json = $.parsejson(j); $(json).each(function(i,val){ $.each(val,function(k,v){ console.log(k+" : "+ v); $('.record').append(k+" : "+ v+'<br>'); }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div class="record"></div>
Comments
Post a Comment