How do I parse this object and get the name (key) for each person?
I can't just do String name = jsonObject.getString("name");
because the name is the key, not the value.
JSONObject jsonObject =
{
"data" :
[{
"Bob": {
"last-name": "Jorgenson",
"email": "b@b.com",
},
"Steve": {
"last-name": "Bobson",
"email": "steve@juno.com",
},
}],
"statusCode" : 200
}
So what's the best way to parse it with the dynamically-named keys?
Update:
jArray was taken from the jsonObject which is now represented. However, I was having trouble implementing answers because of type errors related to trying to get jArray from jsonObject.get("data")
Disclaimer
Yes, this is pretty basic stuff. The dynamic bit is throwing me off though. There are many similar questions, but they usual involve a number of other factors. I can successfully download the data and store it in the JSONObject jsonObject above. I just need to figure out how to parse the data as outlined above.