如何从 OpenRefine 中的列中解析值
How to parse value out of column in OpenRefine
我有 Google 个地点详情的结果。我想从中解析 phone 数字。我怎么能这样做?我正在使用 OpenRefine 并在另一列的基础上使用提取列。
Here is an example of Google Place JSON.
如您所见,"formated_phone_number" 是 "result" 的直系子代。在 Open Refine 中,您可以使用以下 GREL 公式提取此元素:
value.parseJson().result.formatted_phone_number
如果有多个 phone 数字,使用 for
循环遍历数组。 Open refine 中的语法是:
forEach(value.parseJson().result, x, x.formatted_phone_number)
(x是一个变量名,你可以用它或者你想要的代替。)
结果将是一个数组。由于 Open Refine 列只能显示字符串、数字和日期,因此您必须使用连接函数(以及您选择的分隔符)将数组转换为字符串。
forEach(value.parseJson().result, x, x.formatted_phone_number).join('::')
我有 Google 个地点详情的结果。我想从中解析 phone 数字。我怎么能这样做?我正在使用 OpenRefine 并在另一列的基础上使用提取列。
Here is an example of Google Place JSON.
如您所见,"formated_phone_number" 是 "result" 的直系子代。在 Open Refine 中,您可以使用以下 GREL 公式提取此元素:
value.parseJson().result.formatted_phone_number
如果有多个 phone 数字,使用 for
循环遍历数组。 Open refine 中的语法是:
forEach(value.parseJson().result, x, x.formatted_phone_number)
(x是一个变量名,你可以用它或者你想要的代替。)
结果将是一个数组。由于 Open Refine 列只能显示字符串、数字和日期,因此您必须使用连接函数(以及您选择的分隔符)将数组转换为字符串。
forEach(value.parseJson().result, x, x.formatted_phone_number).join('::')