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.
You should land here first if your task already names this workflow. The examples, defaults, and answers on SQL to JSON Converter assume that context.
If your task is more general or you have not narrowed down the workflow yet, start in the Data Conversion Tools and let it route you to the right page.
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.
Move between CSV, JSON, XML, YAML, SQL, tables, and developer-friendly formats with converter pages grouped by workflow.
Need more context before using the tool? Start with one of these workflow guides.