Hi, I'm fairly new to the JSON thing, been searching around the forum for a solution but didn't find anything.
I'm trying to access GOOGLE API that returns a JSON. the whole response is a single cell array. How can I access the value of lat inside location inside geomtry which is inside an array cell?
I haven't been using json.path(), so I tried this myself and now find it indespensable.
One thing that threw me in the example above, though: the results element is a json_list (1 element, but still a list). So to navigate it, I needed to reference its position in the list:
Hi, I'm fairly new to the JSON thing, been searching around the forum for a solution but didn't find anything.
I'm trying to access GOOGLE API that returns a JSON. the whole response is a single cell array. How can I access the value of lat inside location inside geomtry which is inside an array cell?
JSON:
{
"results" : [
{
"address_components" : [
{
"long_name" : "Tzofit",
"short_name" : "Tzofit",
"types" :
},
{
"long_name" : "Israel",
"short_name" : "IL",
"types" :
}
],
"formatted_address" : "Tzofit, Israel",
"geometry" : {
"bounds" : {
"northeast" : {
"lat" : 32.1986450,
"lng" : 34.9319840
},
"southwest" : {
"lat" : 32.1864780,
"lng" : 34.9123460
}
},
"location" : {
"lat" : 32.194880,
"lng" : 34.9200850
},
"location_type" : "APPROXIMATE",
"viewport" : {
"northeast" : {
"lat" : 32.1986450,
"lng" : 34.9319840
},
"southwest" : {
"lat" : 32.1864780,
"lng" : 34.9123460
}
}
},
"types" :
}
],
"status" : "OK"
}
what ever I tried didn't work. Please help, many thanks in advnace,
Amit
try:
v_obj.path('results.geometry.location.lat').get_number();
I haven't been using json.path(), so I tried this myself and now find it indespensable.
One thing that threw me in the example above, though: the results element is a json_list (1 element, but still a list). So to navigate it, I needed to reference its position in the list:
v_obj.path('results.geometry.get_location.lat').get_number();