← All notes

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

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

Claims

Sources

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.

License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: DuckDB, JSON overview; DuckDB, json_extension.cpp. MIT; MIT.

Cite this

Permanent ID: iil:note:7zzfhkcn

iinventedlight. 2026. "DuckDB JSON functions read and build JSON with the json extension." iinventedlight Library, iil:note:7zzfhkcn, version of 2026-11-20. https://iinventedlight.com/library/notes/duckdb-json/. License: CC-BY-4.0.

@misc{iil_note_7zzfhkcn,
  author = {{iinventedlight}},
  title = {{DuckDB JSON functions read and build JSON with the json extension}},
  howpublished = {iinventedlight Library},
  year = {2026},
  date = {2026-11-20},
  url = {https://iinventedlight.com/library/notes/duckdb-json/},
  note = {Permanent ID iil:note:7zzfhkcn. License: CC-BY-4.0.},
}

Markdown

Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).

Extra files beside this note

These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.

All artifact files (JSON index)

For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/duckdb-json.md.