Boneyard Tools

SQL to JSON Converter

Paste SQL INSERT statements and get a JSON array of row objects. Column names become keys, NULL becomes null, numbers and booleans are decoded, and quoted strings are unescaped. Your SQL stays in your browser.

How to convert SQL to JSON

  1. Paste one or more SQL INSERT statements, with or without a column list.
  2. Pick pretty or compact output, and enable MySQL backslash escapes if your dump uses them.
  3. Copy the JSON or download it as a .json file.

Examples

Insert with a column list

INSERT INTO users (id, name) VALUES (1, 'Ada'), (2, 'Linus');
[
  { "id": 1, "name": "Ada" },
  { "id": 2, "name": "Linus" }
]

NULL and quoted text

INSERT INTO t (email, note) VALUES (NULL, 'O''Brien');
[
  { "email": null, "note": "O'Brien" }
]

Frequently asked questions

Is my data uploaded anywhere?

No. The conversion runs entirely in your browser, so your SQL never leaves your device.

What if my inserts have no column list?

When a statement has no column list, the values are keyed col1, col2, col3 and so on, one per value in the tuple.

How are types handled?

Plain numbers become JSON numbers, NULL becomes null, and TRUE and FALSE become booleans. Quoted text becomes a JSON string with doubled quotes ('') unescaped. Very large integers are kept as strings so their precision is not lost.

Which SQL dialects does it accept?

It reads standard INSERT statements from PostgreSQL, MySQL, SQLite and SQL Server, including double-quoted, backtick and bracketed identifiers, comments, and multiple value tuples per statement.

What about backslash escapes like \n?

By default backslashes are kept literal, which is correct for standard SQL and for data such as Windows paths. If your dump uses MySQL backslash escaping, turn on the backslash escapes option to decode \n, \t and \' inside strings.

Does it handle multiple statements at once?

Yes. Paste any number of INSERT statements and every row is collected into a single JSON array. Non-INSERT statements such as CREATE TABLE or SELECT are ignored.

Learn more

  • SQL to JSON examples

    Common INSERT shapes and the JSON they produce, including NULLs, multiple rows and quoted identifiers.

Related tools