36
I am currently working on an android project that requires me to invoke a web service that will return me a json file. I have been using GSON library to parse all the json file and get a JSON object. It has been working well until I come across this json data which the key fields are dynamic. An example of this file is as below:
{ "0": { "count":"5"},
"1": { "title":"...", "desc":"" },
"2": { "title":"...", "desc":"" },
"3": { "title":"...", "desc":"" },
"4": { "title":"...", "desc":"" },
"5": { "title":"...", "desc":"" },
"routes": { "route1":"...", "route3":"" },
}
I am able to get the count based on the key id of "0", but I am not sure how do I make use of this value to get the other key objects (key id 1-5), which consist of the data that I needed. Will really appreciate if anyone is able to help me in this matter. Thanks.