JSONObjectEachRow
Input | Output | Alias |
---|---|---|
✔ | ✔ |
Description
In this format, all data is represented as a single JSON Object, with each row represented as a separate field of this object similar to the JSONEachRow
format.
Example Usage
Basic Example
Given some JSON:
{
"row_1": {"num": 42, "str": "hello", "arr": [0,1]},
"row_2": {"num": 43, "str": "hello", "arr": [0,1,2]},
"row_3": {"num": 44, "str": "hello", "arr": [0,1,2,3]}
}
To use an object name as a column value you can use the special setting format_json_object_each_row_column_for_object_name
.
The value of this setting is set to the name of a column, that is used as JSON key for a row in the resulting object.
Output
Let's say we have the table test
with two columns: