SQL on JSON
SQL on JSON lets you run DuckDB queries against JSON and CSV data directly in the browser. It is useful when a payload is too large or too tabular for Graph or Explorer, or when you need joins, grouping, filtering, and aggregation.
When to Use SQL
Use SQL when you need to:
- Query a large array without expanding every nested branch.
- Compare multiple editor tabs as tables.
- Add temporary JSON or CSV data sources.
- Group, count, aggregate, join, or export query results.
- Keep an analysis query separate from the source payload.
SQL is still browser-first. The query engine runs locally through DuckDB WASM.
Add Data Sources
Open Tools > SQL on JSON or switch to SQL from the workbench tools menu.
You can add sources in three ways:
- Open JSON or CSV tabs in the editor.
- Click Add JSON in the SQL data source panel.
- Import a file as a table source.
Each source appears in the left panel with row and column counts. The generated table name is safe for SQL and can be used in queries immediately.
SELECT *
FROM orders
LIMIT 100;
Query Examples
Filter rows
SELECT *
FROM orders
WHERE status = 'delivered';
Count rows
SELECT COUNT(*) AS total_rows
FROM orders;
Group and sort
SELECT status, COUNT(*) AS count
FROM orders
GROUP BY status
ORDER BY count DESC;
Inspect missing fields
SELECT *
FROM orders
WHERE shipping IS NULL;
Keyboard Shortcuts
| Shortcut | Action |
|---|---|
Cmd+Enter / Ctrl+Enter | Execute query |
Cmd+/ / Ctrl+/ | Toggle SQL comment |
Saving SQL Work
When you save a workspace, SQL data sources and saved queries can be included:
- Editor files become reusable SQL sources.
- SQL-added JSON/CSV sources can become workspace files.
- Query text can be saved as a workspace query.
Guest sessions remain local until you explicitly save or export a workspace.
Large Files
SQL is one of the best paths for large payloads because it avoids rendering every nested branch. If Graph or Explorer shows a large-file guard, use SQL when you need aggregation or joins, and use Grid when you need direct row inspection.
See Large Files for current limits and the paid large-file roadmap.