SQL to JSON Converter

Paste SQL INSERT statements or tabular query output and convert to JSON.

🔒 100% private — runs entirely in your browser

or try sample data

What is SQL to JSON?

SQL to JSON converts SQL INSERT statements or pipe-delimited tabular query output into a JSON array of objects. Column names become object keys, and each row of values becomes a JSON object.

The tool supports two input formats: INSERT INTO statements with explicit column names and VALUES tuples, and pipe-delimited tabular output from command-line tools like psql, mysql, or sqlite3.

This is useful for converting database seed data to JSON fixtures, transforming SQL query results for API consumption, or migrating data between SQL and NoSQL formats. All processing happens in your browser.

SQL to JSON — Common Use Cases

INSERT statement parsing

INSERT INTO users (name, age, city) VALUES
('Alice', 30, 'New York'),
('Bob', 25, 'London'); // Converts to:
[ { "name": "Alice", "age": 30, "city": "New York" }, { "name": "Bob", "age": 25, "city": "London" }
]

NULL, TRUE, FALSE, and numeric values are converted to their JSON equivalents.

Tabular query output

 name | age | city
-------+-----+---------- Alice | 30 | New York Bob | 25 | London // Pipe-delimited output from psql or mysql is also supported

Separator lines (dashes, plus signs) are automatically skipped.

SQL Parsing Gotchas

String quoting

SQL strings must be quoted with single quotes. The parser handles escaped single quotes ('') inside strings. Double-quoted identifiers are also supported for column names.

Complex SQL not supported

This tool parses INSERT statements and tabular output only. It does not execute SQL, handle subqueries, or support CREATE TABLE, UPDATE, or SELECT with WHERE clauses.

Multi-statement input

Only the first INSERT statement is processed. If you have multiple INSERT statements for different tables, convert them separately.

Frequently Asked Questions

What SQL formats are supported?

INSERT INTO statements with explicit column names and VALUES tuples, plus pipe-delimited tabular output from command-line tools like psql, mysql, and sqlite3.

Can I convert multiple INSERT statements?

The tool processes all value tuples from a single INSERT statement, including multi-row inserts. Multiple separate INSERT statements should be converted individually.

How are SQL types converted?

NULL becomes null, TRUE/FALSE become booleans, numeric strings become numbers, and quoted strings remain strings in the JSON output.

Is my data safe?

Yes. All parsing happens in your browser using regex-based parsing. No data or SQL is sent to any server.