---
title: "Getting Data Into ClickHouse - Part 2 - A JSON detour"
description: "ClickHouse's experimental JSON (Object('json')) type, introduced around 22.8, stores semi-structured rows by automatically inferring sub-columns and representing them internally as Tuples with minimal-width numeric types."
url: "https://swe.quest/articles/getting-data-into-clickhouse-part-2-a-json-detour-fe37737f4af7d8af"
canonical: "https://clickhouse.com/blog/getting-data-into-clickhouse-part-2-json"
source: "ClickHouse"
published: "2022-09-01"
difficulty: "medium"
kind: "How-to"
reading_minutes: 9
tags: ["analytics","databases","sql"]
---

# Getting Data Into ClickHouse - Part 2 - A JSON detour

A post on [ClickHouse](https://swe.quest/sources/clickhouse.md), published 2022-09-01, 9 min read, How-to. Original: [https://clickhouse.com/blog/getting-data-into-clickhouse-part-2-json](https://clickhouse.com/blog/getting-data-into-clickhouse-part-2-json)

## Summary

ClickHouse's experimental JSON (Object('json')) type, introduced around 22.8, stores semi-structured rows by automatically inferring sub-columns and representing them internally as Tuples with minimal-width numeric types. It is demonstrated on the 28M-row Hacker News dataset via the JSONAsObject and JSONAsString formats. Because JSON sub-columns cannot serve as primary keys or carry codecs, the recommended pattern is a hybrid schema: declare stable fields like time and type explicitly so they can be used in ORDER BY, and keep the rest in a JSON column. That change cut a sample query from 2.6s to 0.74s. Inferred types widen transparently as new values arrive, but a single string value can silently convert a numeric column to String, so clean the data or declare critical columns explicitly.

Written by swe.quest, not by the author.

**Difficulty:** Medium: assumes a working developer; shows how it is built or done

## Topics

- [Analytics & OLAP](https://swe.quest/tags/analytics.md) (Data & databases)
- [Databases](https://swe.quest/tags/databases.md) (Data & databases)
- [SQL](https://swe.quest/tags/sql.md) (Languages)

## Prerequisites

- SQL basics ([easy posts on SQL](https://swe.quest/tags/sql.md?difficulty=easy))
- ClickHouse MergeTree tables ([easy posts on Analytics & OLAP](https://swe.quest/tags/analytics.md?difficulty=easy))

## Keywords

ClickHouse, JSON, Object('json'), JSONEachRow, JSONAsObject, MergeTree, Hacker News dataset

## Related posts

- [ClickHouse Newsletter April 2022: JSON, JSON, JSON](https://swe.quest/articles/clickhouse-newsletter-april-2022-json-json-json-d21f592453b8c7ef.md): ClickHouse · 2022-04-14 · Medium · 5 min read · Analytics & OLAP, Databases, SQL
  ClickHouse 22.3 LTS adds an experimental JSON data type that stores semi-structured documents in a single column, with dynamic subcolumns underneath, so you no longer need hand-built schemas of arrays and materialized columns.
- [How we built a new powerful JSON data type for ClickHouse](https://swe.quest/articles/how-we-built-a-new-powerful-json-data-type-for-clickhouse-cd5f151dcedf8d3e.md): ClickHouse · 2024-10-22 · Hard · 17 min read · Storage engines, Analytics & OLAP, Databases
  ClickHouse's new JSON type stores every JSON path as a true columnar, dense subcolumn, built on two standalone building blocks: Variant and Dynamic.
- [Getting Data Into ClickHouse - Part 1](https://swe.quest/articles/getting-data-into-clickhouse-part-1-31fa78b8cfd1bb8c.md): ClickHouse · 2022-08-26 · Medium · 11 min read · Analytics & OLAP, SQL, Databases
  ClickHouse can load a 28.7M-row, 4.6GB gzipped Hacker News CSV with a single command, using schema inference via clickhouse-local's file() and the url() table function.
- [ClickHouse Release 24.8 LTS](https://swe.quest/articles/clickhouse-release-24-8-lts-0a43fff10e32a288.md): ClickHouse · 2024-09-03 · Medium · 14 min read · Analytics & OLAP, Databases, SQL
  ClickHouse 24.8 is a Long Term Support release (supported for 12 months) with 19 new features, 18 performance optimisations and 65 bug fixes.
- [Making complex JSON 58x faster, use 3,300x less memory, in ClickHouse](https://swe.quest/articles/making-complex-json-58x-faster-use-3-300x-less-memory-in-clickhouse-7431021b1253a468.md): ClickHouse · 2025-10-09 · Hard · 7 min read · Storage engines, Analytics & OLAP, Performance engineering
  ClickHouse v25.8 adds two new on-disk serializations for the JSON type's shared data, which holds paths beyond the 1,024 dynamic-subcolumn limit.

Browse: [Latest posts](https://swe.quest/index.md) · [Topics](https://swe.quest/tags.md) · [Sources](https://swe.quest/sources.md) · [Topic map](https://swe.quest/map.md) · [Site guide (llms.txt)](https://swe.quest/llms.txt)
