Parse JSON in Google Refine

萝らか妹 提交于 2019-11-29 04:25:57

The field named politics is an array, which you return with:

value.parseJson()[0]["politics"]

One element of that array is associated with the county (it's the one whose friendly_type field is "county"). So you need to filter the politics field to find the one whose friendly_type is county, like this:

filter(value.parseJson()[0]["politics"], item, item["friendly_type"]=="county")

That returns an array with one element. You want to get the name field out of that one element, so you need to extract the name of the zeroth array element, making your complete expression:

filter(value.parseJson()[0]["politics"], item, item["friendly_type"]=="county")[0]["name"]
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!