Skip to content

json_compact ​

Description ​

One JSON document with ordered column names, positional row arrays and a row count. This format is output-only.

Output only. Select it with FORMAT json_compact. Names ignore ASCII case; use the snake_case name shown here.

The document contains ordered column metadata and positional row arrays, plus a row count. Consumers must interpret each row using that declared column order.

This variant is output-only and is distinct from the input/output json_compact_each_row stream. Output has no trailing newline.

text
SELECT expressions FORMAT json_compact;

Example usage ​

sql
SELECT CAST(7 AS Int64) AS id, 'Ada' AS name FORMAT json_compact;
text
{"meta":[{"name":"id"},{"name":"name"}],"data":[[7,"Ada"]],"rows":1}

Output has no trailing newline.

Format settings ​

Use a statement SETTINGS clause; these options are not persisted by SET.

There are no format-specific settings.