I'm trying to extract some data from a JsonObject. The problem is that the fields that come inside that json have unpredictable names.
How can I extract that information having this weird field names?
Here is an example:
"myObject":{
"216cfa89a2de57554b36b177f0bfbb05":{
},
"0cf9182b5ceba2cb64174141a13e647d":{
},
"eb1d1b19e117ba1387a798d9194b4660":{
},
"157b52871e8e560c7ec0be111ef02363":{
},
"4db69dd3a8ae8e0089bd2959ab0c5f86":{
},
}
I'm using gson, where we have the method getAsJsonObject, but how can I use it if I don't know the field names?
JsonObject jsonObject= myObjectJsonObject.getAsJsonObject("???");
Also, there can be a variable number of fields, and this is a problem too. I wonder why I don't get an jsonArray as a response, it would be more suitable and I could have parse it that way.