试图用Open Refine GREL解析Json

时间:2013-08-26 13:03:06

标签: openrefine

我试图解析这个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 })进行地理定位的点隔离开来。

你能告诉我一些我应该做些什么才能成功吗?

1 个答案:

答案 0 :(得分:2)

试试这个:

with(value.parseJson().results[0].geometry.location, pair, pair.lat +", " + pair.lng)