ClickHouse/docs/en/faq/integration/json-import.md
sevirov 8f03e526a4
DOCSUP-3200: Edit and translate to Russian (#16204)
* Edit and translate

Отредактировал английскую версию текстов документов и перевел изменения на русский язык.

* Update trace_log.md

Исправляю битые ссылки.

* Fixing broken links

Исправил битые ссылки.

* Fixing broken links

Поправил битую ссылку, добавив раздел в русскую версию.

Co-authored-by: Dmitriy <sevirov@yandex-team.ru>
2020-10-26 13:09:41 +03:00

1.5 KiB

title toc_hidden toc_priority
How to import JSON into ClickHouse? true 11

How to Import JSON Into ClickHouse?

ClickHouse supports a wide range of data formats for input and output. There are multiple JSON variations among them, but the most commonly used for data ingestion is JSONEachRow. It expects one JSON object per row, each object separated by a newline.

Examples

Using HTTP interface:

$ echo '{"foo":"bar"}' | curl 'http://localhost:8123/?query=INSERT%20INTO%20test%20FORMAT%20JSONEachRow' --data-binary @-

Using CLI interface:

$ echo '{"foo":"bar"}'  | clickhouse-client ---query="INSERT INTO test FORMAT JSONEachRow"

Instead of inserting data manually, you might consider to use one of client libraries instead.

Useful Settings

  • input_format_skip_unknown_fields allows to insert JSON even if there were additional fields not present in table schema (by discarding them).
  • input_format_import_nested_json allows to insert nested JSON objects into columns of Nested type.

!!! note "Note" Settings are specified as GET parameters for the HTTP interface or as additional command-line arguments prefixed with -- for the CLI interface.