3

我正在尝试解析这个 JSON,但真的找不到提取我想要的数据的方法。

{ "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" }

我正在尝试将 lat 和 lng 与我使用 Google Refine GREL ( "location" : { "lat" : 44.19949039999999, "lng" : 0.6172573 }) 进行地理定位的点隔离开来。

你能告诉我我应该怎么做才能成功吗?

4

1 回答 1

2

尝试这个:

with(value.parseJson().results[0].geometry.location, pair, pair.lat +", " + pair.lng)
于 2013-08-26T21:49:30.487 回答