Run SQL queries on JSON data using `DuckDB` in your browser
This tool compiles DuckDB to WebAssembly and runs it entirely in your browser tab. Every JSON tab you have open in the editor is automatically registered as a virtual table. You write standard SQL — SELECT, WHERE, JOIN, GROUP BY, ORDER BY, aggregate functions — and DuckDB's columnar query engine executes it against your JSON data at native speed. There is no server, no upload, no network round-trip. The WASM binary boots once, tables are registered via the duckdb-wasm API, and queries return typed result sets that render as sortable tables with row counts, CSV export, XLSX export, and the option to open results as a new editor tab.
How to query
- 1Open one or more JSON files in the editor — each becomes a SQL table with a sanitized name.
- 2Navigate to the SQL Workspace. Your tables appear in the sidebar with column names and row counts.
- 3Write a SQL query in the editor (e.g.,
SELECT * FROM users WHERE age > 25). - 4Press Run or Ctrl+Enter. Results render as a table below the query editor.
- 5Export results as JSON, CSV, or XLSX, or open them as a new editor tab.
Under the hood
- `DuckDB` WASM engine — The full
DuckDBanalytical database compiled to WebAssembly. Supports window functions, CTEs,CASEexpressions,UNION, subqueries, and most of the SQL:2016 standard. - Automatic table registration — Each open editor tab with valid JSON is registered as a
DuckDBtable usingregisterTable(). Table names are sanitized to valid SQL identifiers with collision avoidance. - `BigInt`-safe serialization —
DuckDBcan returnBigIntvalues for large integers. The export pipeline mapsBigInts to Numbers to ensureJSON.stringifycompatibility. - Multi-format export — Results can be downloaded as JSON, CSV (with proper
RFC 4180escaping), or XLSX with spreadsheet-formula escaping. - Add external tables — Upload additional JSON files directly into the SQL workspace without leaving the page. They're registered as new tables and also persisted as editor tabs.
Real-world scenarios
- Ad-hoc analytics on API data — Pull a JSON response from an API, load it as a table, and run
GROUP BY/COUNT(*)queries to summarize without spinning up a database. - Cross-file JOINs — Open
users.jsonandorders.jsonin separate tabs, thenJOINthem onuser_idto correlate data across files. - Data filtering and transformation — Use
WHEREclauses,CASEexpressions, and string functions to extract exactly the rows and columns you need, then export as CSV. - Quick aggregation —
SUM,AVG,MIN,MAX,COUNT— run aggregate functions on JSON arrays without writing JavaScript.
Sample query
-- Given a "users" table from your JSON tab:
SELECT
city,
COUNT(*) AS user_count,
ROUND(AVG(age), 1) AS avg_age
FROM users
WHERE active = true
GROUP BY city
ORDER BY user_count DESC;
-- Result:
-- +----------+------------+---------+
-- | city | user_count | avg_age |
-- +----------+------------+---------+
-- | New York | 5 | 31.2 |
-- | London | 3 | 28.7 |
-- | Tokyo | 2 | 34.0 |
-- +----------+------------+---------+Questions
Is `DuckDB` actually running in my browser?
Yes. The duckdb-wasm package compiles the full DuckDB C++ engine to WebAssembly. It initializes once when you open the SQL workspace, runs queries in a Web Worker, and requires no backend.
What SQL features are supported?
DuckDB supports a large subset of SQL:2016 including JOINs, subqueries, CTEs (WITH clauses), window functions (ROW_NUMBER, RANK, LAG/LEAD), CASE, UNION/INTERSECT/EXCEPT, and hundreds of built-in functions.
What happens if my JSON is not an array?
Single objects are wrapped in a one-element array and registered as a single-row table. Primitive values are not queryable and are silently skipped during table registration.
Can I query very large JSON files?
DuckDB WASM is limited by available browser memory. Files up to ~50MB work well on modern machines. For larger datasets, consider the native DuckDB CLI.