Skip to content
toolbelt

SQL to JSON

Turn INSERT statements into JSON rows, or generate INSERT statements from a JSON array. Handles escaped quotes, NULL, booleans and a union of keys across rows.

read guide
json rows0 ln / 0 ch
sql
readyunion of keys across rows / NULL, TRUE and FALSE handled
local / nothing uploaded

About this tool

Turn INSERT statements into a JSON array of objects. Value tuples are parsed with quote and nesting awareness, so commas inside strings do not split columns, and NULL and booleans keep their types.

How to use it

  1. Paste one or more INSERT statements targeting the same table.
  2. Press Convert.
  3. Check the JSON: numbers, null and booleans are typed, not strings.
  4. Copy the array for your tests or fixture.

Examples

A single row

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

Limits and notes

  • The statement must include an explicit column list.
  • One table per conversion.

Frequently asked questions

Are doubled quotes handled?
Yes. The SQL escape for an apostrophe is converted back to a single apostrophe.
Why are my dates strings?
SQL dumps quote dates, so they arrive as strings. Convert them where you use the data.
Does it run against a database?
No. It parses text only.
Can it read multiple statements?
It reads the tuples of one INSERT statement. Run it once per statement.

Want the details? Read the full guide: Getting Data Out of a Dump File.