Skip to content

Load JSON rows ​

Use json_each_row to load one object per row into explicit destination columns. Input keys name the columns; the target declarations validate each value.

Create the destination ​

sql
CREATE TABLE json_rows(id UInt64,name String);
text
OK

Send the rows ​

sql
INSERT INTO json_rows FORMAT json_each_row
{"id":1,"name":"Ada"}
{"id":2,"name":"Grace"}
text
OK

Verify in another request ​

sql
SELECT * FROM json_rows ORDER BY id FORMAT csv;
text
1,"Ada"
2,"Grace"

Request and field rules ​

Inline input consumes the remaining request as data. Do not append SELECT after the JSON; send it as another request. Missing fields follow the format's default rules. Unknown fields are errors unless ignore_unknown_fields is enabled.

See json_each_row for field conversion and settings. Whole-document formats serve a different purpose from row objects.