尝试使用Open Refine GREL解析Json [英] Trying to parse a Json with Open Refine GREL

查看:176
本文介绍了尝试使用Open Refine GREL解析Json的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试解析此JSON,但确实找不到提取所需数据的方法.

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

我正在尝试从通过Google Refine GREL("location" : { "lat" : 44.19949039999999, "lng" : 0.6172573 })进行地理定位的点中分离出经纬度.

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?

推荐答案

尝试一下:

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

这篇关于尝试使用Open Refine GREL解析Json的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆