Description
TheJSON format reads and outputs data in the JSON format.
The JSON format returns the following:
The
JSON type is compatible with JavaScript. To ensure this, some characters are additionally escaped:
- the slash
/is escaped as\/ - alternative line breaks
U+2028andU+2029, which break some browsers, are escaped as\uXXXX. - ASCII control characters are escaped: backspace, form feed, line feed, carriage return, and horizontal tab are replaced with
\b,\f,\n,\r,\t, as well as the remaining bytes in the 00-1F range using\uXXXXsequences. - Invalid UTF-8 sequences are changed to the replacement character � so the output text will consist of valid UTF-8 sequences.
output_format_json_quote_64bit_integers to 0.
ClickHouse supports NULL, which is displayed as null in the JSON output. To enable +nan, -nan, +inf, -inf values in output, set the output_format_json_quote_denormals to 1.
Example usage
Example:Format settings
For JSON input format, if settinginput_format_json_validate_types_from_metadata is set to 1,
the types from metadata in input data will be compared with the types of the corresponding columns from the table.
See also
- JSONEachRow format
- output_format_json_array_of_rows setting