JSON object to array using each.
I have array of json object stored in ItemsList variable like this :
ItemsList=[ { ItemID:"1", ItemName: "abc" }, { ItemID: "2", ItemName: "dg" }, { ItemID:"3", ItemName: "erte"} ];
how do I push them into the array variable with key and value using each function.
I tried this :
- var arr= new Array();
- $.each( ItemsList, function(key, obj){
- $.each(obj,function(k,value){
- arr.push(k,value)
- });
- });
Does not give me the output I want.