arrays - jquery map an object with key and value -
i trying map json object array values associated keys. need keep keys , values associated because sort on created array after. object :
{"178":"05hy24","179":"1hy12","292":"1hy24","180":"3hy12"}
i have tryed array function :
value=$.map(value, function(value, key) { return key,value; });
but keys not associated values. keys 0,1,2,3 , not 178,179,292,180. try lot of things don't know how that.
var myhashmap = json.parse('{"178":"05hy24","179":"1hy12","292":"1hy24","180":"3hy12"}'); console.log(myhashmap[178]); // => "05hy24" // map array.. var myarray = $.map(myhashmap, function(value, index) { return [value]; }); console.log(myarray);
Comments
Post a Comment