Unnest object (flatten JSON)¶
This processor unnests / flattens JSON objects or arrays.
Example
——-
For input in column jsoncol
:
{"firstname" : "a", "lastname" : "b", "details" : { "uid": 237, "comment" : " a comment"}
Output will be:
- jsoncol.firstname = a
- jsoncol.lastname = b
- jsoncol.details.uid = 237
- jsoncol.details.comment = a comment # Handling of arrays By default, arrays are kept untouched, ie:
- If the column contains a JSON object which contains a JSON array, the JSON array will be preserved a single column
- If the column contains a JSON array at top level, then the processor will do nothing
You can manually enable flattening of JSON arrays. Beware: very large arrays could lead to high memory and CPU consumption.