Javascript JSON Array -
this question has answer here:
i using request server api , making request , doing this:
var resp = json.parse(response);
i call server providing 0001 & 0002 arguments , after json.parse returns array such as:
{"0001":{"id":1},"0002":{"id":2}}
i know traditionally if given static responses such as
{"placeid":{"id":1},"placeid":{"id":2}}
i this:
resp.placeid.id
but given return names aren't same how can access first value resp.0001.id
given 0001
may not value returned?
use for...in
loop.
for(var property in resp) { console.log(property + ": " + resp[property]); }
Comments
Post a Comment