Skip to content

json_compact_strings_each_row ​

Description ​

Positional JSON row arrays containing complete native text as JSON strings. SQL NULL is the string "ᴺᵁᴸᴸ". Known input fields must be strings; bare JSON null is rejected. Nullable targets also accept the string "NULL", ignoring ASCII case. Input converts text through the target column declarations.

Input and output. Select it with FORMAT json_compact_strings_each_row. Names ignore ASCII case; use the snake_case name shown here.

Position identifies each column, but every field is a JSON string containing the complete native text value. This includes numbers, collections and the SQL NULL marker.

Input validates string fields before converting them through the target type. JSON null is not a valid substitute for a known field; nullable targets accept the documented textual NULL markers.

text
SELECT expressions FORMAT json_compact_strings_each_row;
INSERT INTO table [(columns)] [SETTINGS ...] FORMAT json_compact_strings_each_row
<data>

Example usage ​

sql
SELECT CAST(7 AS Int64) AS id, 'Ada' AS name FORMAT json_compact_strings_each_row;
text
["7", "Ada"]
sql
SELECT NULL AS value FORMAT json_compact_strings_each_row;
text
["ᴺᵁᴸᴸ"]

Format settings ​

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

Setting Type Default Meaning
json_array_of_rows Bool 0 Wrap all output rows in one JSON array.
json_compact_strings_each_row_sql_defaults Bool 1 Evaluate SQL DEFAULT expressions for missing or defaulted positional whole-text JSON fields; off supplies their native type defaults.
json_compact_uneven_rows Bool 0 Give missing positional fields their SQL or native defaults and validate then skip extra fields.
json_empty_as_default Bool 0 Give empty JSON string fields their SQL or native type default.
json_escape_slashes Bool 1 Escape unescaped forward slashes in JSON output strings.
json_strict_escapes Bool 1 Reject invalid JSON escapes; otherwise preserve their literal backslash spelling.
json_validate_utf8 Bool 0 Replace invalid UTF-8 sequences in whole-text JSON output with replacement characters; off preserves byte-string payloads.
snappy_mode String basic Read Snappy client files as basic (Hadoop blocks) or framed (standard streaming format).