【问题标题】:How to parse value out of column in OpenRefine如何在 OpenRefine 中解析列中的值
【发布时间】:2017-11-29 15:02:44
【问题描述】:

我有来自 Google 地点详细信息的结果。我想从中解析出电话号码。我怎么能这样做?我正在使用 OpenRefine 并在另一列的基础上使用获取列。

【问题讨论】:

标签: javascript java api google-maps-api-3 openrefine


【解决方案1】:

Here is an example of Google Place JSON.

如您所见,“formated_phone_number”是“result”的直接子代。在 Open Refine 中,您可以使用以下 GREL 公式提取此元素:

value.parseJson().result.formatted_phone_number

如果有多个电话号码,请使用 for 循环遍历数组。 Open细化中的语法是:

forEach(value.parseJson().result, x, x.formatted_phone_number)

(x是变量名,你可以用它或者你想要的。)

结果将是一个数组。由于 Open Refine 列只能显示字符串、数字和日期,因此您必须使用 join 函数(以及您选择的分隔符)将数组转换为字符串。

forEach(value.parseJson().result, x, x.formatted_phone_number).join('::')

【讨论】:

  • 你先生,是个传奇。
猜你喜欢
  • 2017-05-20
  • 2021-10-24
  • 1970-01-01
  • 1970-01-01
  • 2015-04-03
  • 1970-01-01
  • 1970-01-01
  • 2020-02-28
  • 2015-10-21
相关资源
最近更新 更多