JSON Analysis

Query JSON and NDJSON files with SQL

SQL for Files turns JSON arrays and newline-delimited JSON into DuckDB tables so you can filter, join, and summarize nested exports locally.

Supports JSON arrays and NDJSON records

Useful for API exports, logs, and application data snapshots

DuckDB SQL support for filtering, grouping, joining, and unnesting

All processing happens in the browser

How it works

  1. Add a .json file that holds a JSON array of objects or newline-delimited JSON with one object per line.
  2. DuckDB's JSON reader detects fields and types; nested objects become STRUCT columns and arrays become LIST columns.
  3. Query top-level fields like normal columns, read nested fields with dot notation, and expand arrays with UNNEST.

Example queries

Filter imported JSON records

SELECT id, status, created_at
FROM events
WHERE status = 'active'
ORDER BY created_at DESC;

Summarize JSON events

SELECT type, COUNT(*) AS events
FROM events
GROUP BY type
ORDER BY events DESC;

Frequently asked questions

Is my file uploaded anywhere?

No. SQL for Files reads the file in your browser and loads it into DuckDB-WASM running on your device. The app does not send file contents, SQL queries, or query results to a server.

Does SQL for Files support NDJSON?

Yes, when the file uses the .json extension. DuckDB's JSON reader handles both a single JSON array of objects and newline-delimited JSON with one object per line.

How do I query nested JSON fields?

Nested objects are loaded as STRUCT columns, so you can read a field with dot notation such as customer.address.city. Arrays become LIST columns that UNNEST turns into one row per element.