{}JSONFiddleEditor
Tools/
Data Sources (0)

No data sources yet

or open tabs in the editor first

SQL Query
Ctrl+Enter execute  · Ctrl+/ toggle comment
Results
Execute a query to see resultsResults will appear here after running your SQL query

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

  1. 1Open one or more JSON files in the editor — each becomes a SQL table with a sanitized name.
  2. 2Navigate to the SQL Workspace. Your tables appear in the sidebar with column names and row counts.
  3. 3Write a SQL query in the editor (e.g., SELECT * FROM users WHERE age > 25).
  4. 4Press Run or Ctrl+Enter. Results render as a table below the query editor.
  5. 5Export results as JSON, CSV, or XLSX, or open them as a new editor tab.

Under the hood

  • `DuckDB` WASM engineThe full DuckDB analytical database compiled to WebAssembly. Supports window functions, CTEs, CASE expressions, UNION, subqueries, and most of the SQL:2016 standard.
  • Automatic table registrationEach open editor tab with valid JSON is registered as a DuckDB table using registerTable(). Table names are sanitized to valid SQL identifiers with collision avoidance.
  • `BigInt`-safe serializationDuckDB can return BigInt values for large integers. The export pipeline maps BigInts to Numbers to ensure JSON.stringify compatibility.
  • Multi-format exportResults can be downloaded as JSON, CSV (with proper RFC 4180 escaping), or XLSX with spreadsheet-formula escaping.
  • Add external tablesUpload 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 dataPull 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 JOINsOpen users.json and orders.json in separate tabs, then JOIN them on user_id to correlate data across files.
  • Data filtering and transformationUse WHERE clauses, CASE expressions, and string functions to extract exactly the rows and columns you need, then export as CSV.
  • Quick aggregationSUM, 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.

Related tools