JSONEachRow:
JSONCompactEachRow to save disk space by skipping column names:
Overriding data types as strings
ClickHouse respects data types and will export JSON accordingly to standards. But in cases where we need to have all values encoded as strings, we can use the JSONStringsEachRow format:hits numeric column is encoded as a string. Exporting as strings is supported for all JSON* formats, just explore JSONStrings\* and JSONCompactStrings\* formats:
Exporting metadata together with data
General JSON format, which is popular in apps, will export not only resulting data but column types and query stats:JSONStrings or JSONCompactStrings variants to encode all values as strings.
Compact way to export JSON data and structure
A more efficient way to have data, as well as it’s structure, is to useJSONCompactEachRowWithNamesAndTypes format:
Exporting JSON to a file
To save exported JSON data to a file, we can use an INTO OUTFILE clause:COMPRESSION clause to enable compression on the fly: