fieldnamesFromJson
Get fieldnames from JSON object
Extract all first level keys from JSON objects in a column.
The jsonToColumns operator extracts all keys in the JSON object into separate columns. Later in a playbook you might be doing some processing on those columns. In a different batch this playbook might fail, because jsonToColumns produces columns from JSON dynamically, and it is not guaranteed that all keys existed in the previous batch will be present in the current batch. If the playbook depends on some columns that are not present in the output of jsonToColumns operator, the playbook will fail to execute.
This operator allows you to extract all possible keys from the JSON object and use the output as a defaultFields
argument in the jsonToColumns operator.
Operator Usage in Easy Mode
- Click + on the parent node.
- Enter Field Names from JSON operator in the search field and select the operator from the Results to open the operator form.
- In the Input Table drop-down, enter or select the table containing the data to run this operator on.
- In the JSON field, enter or select a column from the drop-down that contains the JSON object.
- Click Run to view the result.
- Click Save to add the operator to the playbook.
- Click Cancel to discard the operator form.
Usage Details
fieldnamesFromJson(input_table, "jsonField")
Input
table
: Table name to apply operator.
jsonField
: Field name that contains the JSON object.
Example
Input
_raw |
---|
{"a":1, "b":2} |
{"c":1, "d":2} |
Output
fieldnamesFromJson(input_table, "_raw") -- produces"a, b, c, d" output
Updated about 1 year ago