I am facing a JSON issue and do not know to approach it. I am trying to obtain a JSONArray though the application will never know the corresponding name to this data set. For example, we have something like the following data set:
{"Kobe":[{"Location":"LA","Position":"PG"}]}
Normally to obtain the value corresponding with Kobe I would use:
contentArray = json.getJSONArray("Kobe");
By doing this I would obtain the array that has two elements, Location and Position. My question is, what happens if I do not know that the name is "Kobe". I need to somehow dynamically at run time get the appropriate name to pass into the .getJSONArray() function. The application is blind and unaware of the name value pairs until the data actually arrives from the server. Any ideas, thoughts, code snippets are welcome.
Thanks.