SQL to JSON
Turn INSERT statements into JSON rows for fixtures, seeds and tests.
Nothing converted yet
Paste INSERT statements to get a JSON array of rows, with numbers, booleans and NULL typed correctly.
Runs entirely in your browser. Your data isn't uploaded — this page makes no network request with anything you type, which you can verify in your browser's network tab. How this works.
What is the SQL to JSON?
Test fixtures, seed data and API mocks are often derived from SQL that already exists — a dump, a set of INSERT statements from a migration, or rows exported from a staging database. Converting them by hand is tedious and error-prone.
Paste INSERT statements here and get a JSON array of row objects, with column names as keys and values typed sensibly: numbers stay numbers, NULL becomes null, and booleans are recognised. CREATE TABLE statements can be converted into a JSON Schema sketch instead.
How to use it
- Paste one or more INSERT statements, including the column list.
- Press Convert (or Ctrl/Cmd + Enter).
- Choose whether to group rows by table when the input covers several.
- Copy the JSON, or download it as a fixture file.
Example
A multi-row INSERT turned into fixture data.
INSERT INTO regions (code, name, active) VALUES ('eu-west-1','Ireland',true),('ap-southeast-1','Singapore',false);
[
{ "code": "eu-west-1", "name": "Ireland", "active": true },
{ "code": "ap-southeast-1", "name": "Singapore", "active": false }
]
Features
- Multi-row and multi-statement INSERT support
- Type inference for integers, decimals, booleans and NULL
- Correct handling of escaped quotes inside string literals
- Optional grouping by table name
- CREATE TABLE to JSON Schema sketch mode