Skip to main content
Convert2JSON Tools

SQL to JSON

Extract the rows out of INSERT statements and get them back as a clean JSON array of objects.

Your data stays on your device

Input — SQL

characters
0
lines
0
size
0 B

Output — JSON

characters
0
lines
0
size
0 B

Options

About this tool

Database dumps and seed files are full of INSERT statements. When you need that data as JSON — for a fixture, an API mock or a quick inspection — this tool parses the statements and rebuilds each row as an object keyed by its columns.

It reads text only; it never executes SQL or connects anywhere. It understands single and multi-row INSERTs across MySQL, PostgreSQL and SQLite, resolves NULL, numbers, TRUE/FALSE and quoted strings with escaped quotes, and skips comments.

How to use this tool

  1. Paste one or more INSERT … VALUES statements.
  2. Choose an indentation style for the JSON output.
  3. Press Parse SQL to turn the rows into objects.
  4. Copy or download the resulting JSON array.

Key features

  • Single and multi-row INSERT statements
  • Column names taken from the statement
  • NULL, numbers, booleans and strings decoded correctly
  • Doubled and backslash-escaped quotes handled
  • Line and block comments ignored

Example

An INSERT becomes JSON rows

InputSQL

INSERT INTO users (id, name) VALUES (1, 'Ada'), (2, 'Alan');

OutputJSON

[
  { "id": 1, "name": "Ada" },
  { "id": 2, "name": "Alan" }
]

Good to know

  • Only INSERT … VALUES is parsed. SELECT, CREATE, UPDATE, DELETE and stored procedures are reported as unsupported.
  • Expressions and function calls in values are kept as literal strings, since nothing is evaluated.

Frequently asked questions

Is my SQL executed?

No. The statements are parsed as text. Nothing connects to a database and no expression is evaluated.

What happens to an INSERT without a column list?

Values are keyed positionally as column_1, column_2 and so on, since the names are not present to use.

Which dialects are supported?

MySQL, PostgreSQL and SQLite INSERT syntax, including backtick and double-quoted identifiers.

Your data stays on your device

Your data is processed locally in your browser and is not uploaded to our server. This page keeps working after you go offline, because there is nothing to send.

Share this toolXLinkedInHacker News