I'm trying to parse this JSON but really can't find the way to extract the data I want.
{ "results" :
[ { "address_components" :
[
{ "long_name" : "44", "short_name" : "44", "types" : [ "street_number" ] },
{ "long_name" : "Rue Montaigne", "short_name" : "Rue Montaigne", "types" : [ "route" ] },
{ "long_name" : "Agen", "short_name" : "Agen", "types" : [ "locality", "political" ] },
{ "long_name" : "Lot-et-Garonne", "short_name" : "Lot-et-Garonne", "types" : [ "administrative_area_level_2", "political" ] },
{ "long_name" : "Aquitaine", "short_name" : "Aquitaine", "types" : [ "administrative_area_level_1", "political" ] },
{ "long_name" : "France", "short_name" : "FR", "types" : [ "country", "political" ] },
{ "long_name" : "47000", "short_name" : "47000", "types" : [ "postal_code" ] }
],
"formatted_address" : "44 Rue Montaigne, 47000 Agen, France",
"geometry" : {
"bounds" : {
"northeast" : { "lat" : 44.1994907, "lng" : 0.6172573 },
"southwest" : { "lat" : 44.19949039999999, "lng" : 0.6172388999999999 }
},
"location" : { "lat" : 44.19949039999999, "lng" : 0.6172573 },
"location_type" : "RANGE_INTERPOLATED",
"viewport" : {
"northeast" : { "lat" : 44.20083953029149, "lng" : 0.618597080291502 },
"southwest" : { "lat" : 44.1981415697085, "lng" : 0.6158991197084979 }
}
},
"partial_match" : true,
"types" : [ "street_address" ]
} ],
"status" : "OK" }
I'm trying to isolate the lat and the lng from the point I geolocalized with Google Refine GREL ("location" : { "lat" : 44.19949039999999, "lng" : 0.6172573 }
).
Can you give me a hint of what I should do to succeed?
Try this:
with(value.parseJson().results[0].geometry.location, pair, pair.lat +", " + pair.lng)
来源:https://stackoverflow.com/questions/18444834/trying-to-parse-a-json-with-open-refine-grel