When I am using a get request from a server API and making a request, I then proceed to do the following:
var resp = JSON.parse(response);
For example, if I call to the server with 0001 & 0002 as arguments, after the JSON parse I might receive an array like this:
{"0001":{"id":1},"0002":{"id":2}}
In cases where traditional static responses are provided like this:
{"placeID":{"id":1},"placeID":{"id":2}}
I would usually access the values like this:
resp.placeId.id
But what if the return names are not always the same? How can I access that first value resp.0001.id
when 0001
may vary?