I feel dumb, but I was looking for it for a while. I am working with google geocoding API and I need a little help with json answers. Here is the JSONObject that I have:
{
"viewport": {
"southwest": {
"lng": -78.9233749802915,
"lat": 36.00696951970851
},
"northeast": {
"lng": -78.92067701970849,
"lat": 36.0096674802915
}
},
"location_type": "ROOFTOP",
"location": {
"lng": -78.922026,
"lat": 36.0083185
}
}
How can I put the subfield "location" in my own variables? I tried jsonObjectVariable.getString("location");, jsonObjectVariable.getDouble()etc., but it didn’t return correctly. What do you call a subfield in a json object? I read that you can access subfields with object.subobject syntax, but I just don't get what I need.
(I use json-org as a library)
Thanks for the help!
source
share