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 operatorjson_extractthe function callJSONPathand JSON Pointer syntax for extractionJSON Pointerthe 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
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
jsonextension 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 thejson_extractfunction 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.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: DuckDB, JSON overview; DuckDB, json_extension.cpp. MIT; MIT.
Cite this
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.},
}
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.
- duckdb-json.table.json (table; CC-BY-4.0)
- duckdb-json.schema.json (schema; CC-BY-4.0)
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.