---
source: https://iinventedlight.com/library/notes/duckdb-json.md
title: "DuckDB JSON functions read and build JSON with the json extension"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "MIT (DuckDB); MIT (DuckDB); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: DuckDB, JSON overview; DuckDB, json_extension.cpp. MIT; MIT."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-20
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-20
as_of: 2026-11-20
confidence: medium
untested: "Not reproduced (2026-11-20). Official docs and source files were read; no test suite, server, or API call was run for this note."
category: coding-references
topic_area: "code-systems: DuckDB JSON functions"
tags: [duckdb, json, sql, databases]
client: Librarian
sources:
  - id: S1
    title: "JSON overview"
    publisher: DuckDB
    url: https://duckdb.org/docs/2.0/data/json/overview.html
    accessed: 2026-11-20
    license: "MIT"
  - id: S2
    title: "json_extension.cpp"
    publisher: DuckDB
    url: https://raw.githubusercontent.com/duckdb/duckdb/main/extension/json/json_extension.cpp
    accessed: 2026-11-20
    license: "MIT"
---
# DuckDB JSON functions read and build JSON with the json extension
**Answer:** DuckDB supports SQL functions useful for reading values from existing JSON and for creating new JSON data. The json extension ships with most DuckDB distributions and loads automatically on first use. To install or load it by hand, consult the Installing and Loading page.

## JSONPath and JSON Pointer

- `->` the arrow operator
- `json_extract` the function call
- `JSONPath` and JSON Pointer syntax for extraction
- `JSON Pointer` the other extraction interface

Both of them work with the arrow operator and the json_extract function call. JSON is an open standard file format used for data interchange. It is not a very efficient format for tabular data, but it is commonly used for that interchange role.

## Macros in the extension

JSON_MACROS include json_group_array, json_group_object, json_group_structure, and json as json_extract(x, '$'). json_copy_strftime_if_date and json_copy_strftime_if_timestamp are also listed there. The `json_geometry_format` option chooses how GEOMETRY values are written: `wkt` (Well-Known Text) or `geojson` (GeoJSON objects). `COPY ... TO ... (FORMAT GEOJSON)` always writes GeoJSON, regardless of that option.

## See also

- [postgres-json-jsonb](https://iinventedlight.com/library/notes/postgres-json-jsonb/)
- [sqlite-json](https://iinventedlight.com/library/notes/sqlite-json/)
- [duckdb-extensions](https://iinventedlight.com/library/notes/duckdb-extensions/)

## Claims

- id: C1
  claim: JSON support ships in the json extension, which most distributions auto-load on first use.
  source: S1
  evidence: "JSON is supported with the `json` extension which is shipped with most DuckDB distributions"

- id: C2
  claim: Extraction uses JSONPath or JSON Pointer, including the arrow operator and json_extract.
  source: S1
  evidence: "Both of them work with the arrow operator (`->`) and the `json_extract` function call."

- id: C3
  claim: The extension also registers macros such as json_group_array and a json() wrapper around json_extract.
  source: S2
  evidence: "COPY ... TO ... (FORMAT GEOJSON) always writes GeoJSON regardless of this setting."

## Sources

- [S1] JSON overview. DuckDB. https://duckdb.org/docs/2.0/data/json/overview.html . License: MIT. Accessed 2026-11-20.

- [S2] json_extension.cpp. DuckDB. https://raw.githubusercontent.com/duckdb/duckdb/main/extension/json/json_extension.cpp . License: MIT. Accessed 2026-11-20.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: DuckDB, JSON overview; DuckDB, json_extension.cpp. MIT; MIT. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
