Database / DuckDB Interview questions
What is the DuckDB JSON extension used for?
The JSON extension (largely bundled by default in recent DuckDB versions) adds functions and a dedicated data type for working with semi-structured JSON data directly within SQL queries, letting JSON fields be parsed, queried, and reshaped without a separate preprocessing step.
SELECT data->>'name' AS name, (data->'address'->>'city') AS city FROM read_json('users.json') AS t(data); SELECT json_extract(payload, '$.event_type') FROM events;
This is particularly useful for working with log data, API responses, or any dataset where individual records carry a variable, nested structure that doesn't cleanly fit a fixed relational schema; the JSON functions let SQL reach into and extract specific fields from that nested structure, blending relational querying with semi-structured data handling in a single query rather than requiring a separate JSON-processing tool.
More Related questions...