# JSON data

JSON formats expose several layouts. Choose according to the consumer's expected shape, rather than treating every JSON representation as interchangeable.

## Rows and columns

`json_each_row` writes one named object per row. `json_compact_each_row` writes positional arrays. `json_columns` and `json_compact_columns` transpose rows into arrays for each column.

`json` writes one document containing runtime metadata and row objects. The whole-document input formats `json_as_object` and `json_as_string` load a document into one destination column.

## Example

```sql
SELECT 7 AS id, 'Ada' AS name
FORMAT json_each_row;
```

```text
{"id":7,"name":"Ada"}
```

## Schema

Create explicit target declarations before loading; general schema inference is not supported. A JSON typed column can additionally validate selected paths within a document.

Read [Load JSON](https://coordinatordb.com/docs/guides/clickhouse/data-formats/json/loading), [Export JSON](https://coordinatordb.com/docs/guides/clickhouse/data-formats/json/exporting), [Format choices](https://coordinatordb.com/docs/guides/clickhouse/data-formats/json/formats), [Expand JSON into rows](https://coordinatordb.com/docs/guides/clickhouse/data-formats/json/other) and [Validate JSON fields](https://coordinatordb.com/docs/guides/clickhouse/data-formats/json/schema).
