Skip to content

Extract json values

fast step  textNLPregular expression

Extract values from JSON columns using JsonPath.

A JsonPath is a string that uses a syntax similar to XPath to extract values from JSON objects. The syntax is described in the JsonPath Online Evaluator.

Usage


The following are the step's expected inputs and outputs and their specific types.

Step signature
extract_json_values(text: text|category, {"param": value}) -> (value_extracted: column)

where the object {"param": value} is optional in most cases and if present may contain any of the parameters described in the corresponding section below.

Example

Extract all the cities from a column with Json values.

Example call (in recipe editor)
extract_json_values(ds.text, {
  "path": "address.city",
  "type": "text"
}) -> (ds.cities)

Inputs


text: column:text|category

A text column with Json values to extract parts from.

Outputs


value_extracted: column

The column resulting from evaluating the JsonPath expression on the input column.

Parameters


path: string

JsonPath string used to extract the values from the JSON values of the columns.

Example parameter values:

  • json "address.city"

type: string

Output column type. Select the desired type using a shortened yet fully specified name.

Must be one of: "boolean", "category", "date", "number", "text", "url", "list[number]", "list[category]", "list[url]"