WebToolsPlanet
Converter Tools

SQL to JSON Converter

Paste one or more SQL INSERT statements and get back the rows as a JSON array — with column names as keys and proper type detection for strings, numbers, NULL, and booleans.

Last updated: May 27, 2026

Client-Side Processing
Input Data Stays on Device
Instant Local Execution

Find this tool useful? Support the project to keep it free!

Buy me a coffee

What is SQL to JSON Converter?

Database fixtures and export files often live as raw `INSERT INTO` statements — but downstream tools usually want JSON. Manually converting a multi-row insert is tedious and error-prone, especially with escaped strings and NULL values mixed in.

This converter parses INSERT statements like a real SQL tokenizer: it understands the three identifier-quoting styles (backticks for MySQL, double quotes for PostgreSQL, brackets for SQL Server), single- and double-quoted strings with both backslash and doubled-quote escaping, comments, and the NULL/TRUE/FALSE keywords. The result is a clean JSON array, one object per row, with the column names from the `INSERT INTO ... (...)` clause as keys.

How to Use SQL to JSON Converter

1

Paste one or more SQL INSERT statements.

2

Toggle pretty printing and indent.

3

Optionally wrap the output as { tableName: [...] } if you want to preserve the table name.

4

Copy the JSON output.

Common Use Cases

  • Converting a database dump (.sql) into JSON fixtures for a test suite.
  • Extracting tabular data from a SQL export for use in a JavaScript app.
  • Migrating from a SQL-based fixture format to a JSON one.
  • Debugging an INSERT by viewing the rows as parsed JSON.

Example Input and Output

A multi-row INSERT becomes a JSON array of objects.

SQL input
INSERT INTO users (id, name, active) VALUES (1, 'Alice', TRUE), (2, 'Bob', FALSE);
JSON output
[
  { "id": 1, "name": "Alice", "active": true },
  { "id": 2, "name": "Bob",   "active": false }
]

Privacy

All parsing happens in your browser. No SQL is sent to a server.

Number precision

Numbers larger than 2^53 lose precision in JavaScript. For BIGINT values, wrap them in quotes in the SQL (or post-process) to keep them as strings.

Frequently Asked Questions

Which SQL dialects are supported?
The parser handles all the major identifier-quoting and string-escaping styles: MySQL backticks, PostgreSQL/standard double quotes, SQL Server brackets, single-quoted strings with both backslash and doubled-quote escapes. Pure SELECT or DDL is not parsed — INSERT only.
What if my INSERT has no column list?
The tool defaults to col1, col2, col3, ... in column order. Add an explicit column list to your INSERT for meaningful key names.
How are NULL, TRUE, FALSE represented?
NULL becomes JSON null, TRUE becomes true, FALSE becomes false. Quoted "NULL" stays a string.
Does this send my SQL anywhere?
No. All parsing happens locally in your browser.