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.
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.
name | age | city
-------+-----+---------- Alice | 30 | New York Bob | 25 | London // Pipe-delimited output from psql or mysql is also supportedSeparator lines (dashes, plus signs) are automatically skipped.
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.
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.
Only the first INSERT statement is processed. If you have multiple INSERT statements for different tables, convert them separately.
INSERT INTO statements with explicit column names and VALUES tuples, plus pipe-delimited tabular output from command-line tools like psql, mysql, and sqlite3.
The tool processes all value tuples from a single INSERT statement, including multi-row inserts. Multiple separate INSERT statements should be converted individually.
NULL becomes null, TRUE/FALSE become booleans, numeric strings become numbers, and quoted strings remain strings in the JSON output.
Yes. All parsing happens in your browser using regex-based parsing. No data or SQL is sent to any server.