The PARSE-AS-JSON directive is for parsing a JSON object. The directive can operate on String or JSONObject types. When the directive is applied, the high-level keys of the JSON are appended to the original column name to create new column names.
Syntax
Code Block |
---|
parse-as-json :column [depth] |
column
is the name of the column in the record that is a JSON object.depth
indicates the depth at which JSON object enumeration terminates.
Usage Notes
The PARSE-AS-JSON directive breaks down complex JSON into simpler understandable and manageable chunks. When first applied on a JSON object, it breaks it down into keys and values. The value could in itself be a JSON object on which you can apply the PARSE-AS-JSON directive again to flatten it out further.
The key names in the event object are appended to the column that is being applied JSON parsing. The column names use dot notation.
Examples
Using this record as an example, in a field body
:
...