java - Parse tricky json -


how parse json in java , value of city field?

{"20511232":{"id":"20511232", "name":"xyz" ,"address":{"city":"abc","state":"bcv"}}} 

note root key value of id field.

i know can hardcode this

json.getjsonobject("20511232").getjsonobject("address").getstring("city"); 

but if have many such json. note: using org.json.jsonobject

don't understand why got voted down.anyways worked out using keys() method suggested @henry in comments.


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -