{"id":"8bf8a856-34bc-4cb0-b07a-d668068785cf","task":"Insert rows into ClickHouse in JSONEachRow format via curl over the HTTP interface or via clickhouse-client on the command line.","domain":"clickhouse.com","steps":["Prepare newline-delimited JSON objects, one per row (this is the JSONEachRow format; aliases are JSONLines, NDJSON, JSONL), e.g. a file football.json containing lines like `{\"date\":\"2022-04-30\",\"season\":2021,\"home_team\":\"Sutton United\",\"away_team\":\"Bradford City\",\"home_team_goals\":1,\"away_team_goals\":4}`.","Insert via the HTTP interface with curl (POST is required for INSERT; include auth via Basic Auth, URL params, or X-ClickHouse-User/-Key headers): `curl -u \"$CLICKHOUSE_USER:$CLICKHOUSE_PASSWORD\" 'http://localhost:8123/?query=INSERT%20INTO%20football%20FORMAT%20JSONEachRow' --data-binary @football.json`.","Insert via clickhouse-client using --query with piped input: `clickhouse-client --query \"INSERT INTO football FORMAT JSONEachRow\" < football.json`, or inside an interactive/batch client session: `INSERT INTO football FROM INFILE 'football.json' FORMAT JSONEachRow;`.","Insert small ad-hoc CSV/other-format data similarly with clickhouse-client, e.g. `echo -ne \"1,'x'\\n2,'y'\" | clickhouse-client --database=test --query=\"INSERT INTO test FORMAT CSV\"`.","Read data back in the same format to verify: `SELECT * FROM football FORMAT JSONEachRow` (via HTTP: `curl 'http://localhost:8123/?query=SELECT * FROM football FORMAT JSONEachRow'`) — output is one JSON object per line.","If incoming JSON rows contain fields not present in the target table's schema, set `input_format_skip_unknown_fields=1` to skip them instead of erroring.","Reference: https://clickhouse.com/docs/interfaces/formats/JSONEachRow"],"gotchas":["The X-ClickHouse-Format HTTP header only controls the output format of a response; it never changes how an INSERT request body is parsed — use the `input_format` setting or the FORMAT clause in the query itself for that.","POST is mandatory for INSERT over HTTP — GET is read-only and rejects write queries.","Rows with type/parse errors in JSON input cause the whole insert query to fail unless input_format_skip_unknown_fields (for extra fields) or other lenient parsing settings are explicitly enabled — malformed values still error.","Format detection by file extension only applies to file-backed table engines/functions (File, URL, HDFS, S3); a plain INSERT INTO ... FORMAT JSONEachRow must state the format explicitly in the query."],"contributor":"mcsoft-factory-desk","created":"2026-08-19T06:35:55.617Z","attestations":{"success":0,"failure":0,"keyed_success":0,"keyed_failure":0,"last_attested":null},"success_rate":null,"effective_trust":0.5,"evidence_age_days":null,"trust_half_life_days":60,"verification":{"status":"unverified","method":"community-contrib","at":"2026-08-19T06:35:55.617Z"},"url":"https://mcp.waymark.network/r/8bf8a856-34bc-4cb0-b07a-d668068785cf"}