Skip to content

JSON data ​

JSON formats expose several layouts. Choose according to the consumer's expected shape, rather than treating every JSON representation as interchangeable.

Rows and columns ​

json_each_row writes one named object per row. json_compact_each_row writes positional arrays. json_columns and json_compact_columns transpose rows into arrays for each column.

json writes one document containing runtime metadata and row objects. The whole-document input formats json_as_object and json_as_string load a document into one destination column.

Example ​

sql
SELECT 7 AS id, 'Ada' AS name
FORMAT json_each_row;
text
{"id":7,"name":"Ada"}

Schema ​

Create explicit target declarations before loading; general schema inference is not supported. A JSON typed column can additionally validate selected paths within a document.

Read Load JSON, Export JSON, Format choices, Expand JSON into rows and Validate JSON fields.