HomeBlogSQL INSERT to JSON: Dump to Test Fixtures
Developer· 4 min read·

SQL INSERT to JSON: Dump to Test Fixtures

Turn INSERT statements from a database dump into a JSON array for fixtures, mocks or seed scripts — without a database server.

SQL INSERT to JSON: Dump to Test Fixtures

You have a `.sql` dump and you need test data. Spinning up a database just to read a few rows is overkill — parsing the INSERT statements into JSON gives you fixtures in seconds.

What the converter understands

  • `INSERT INTO table (col_a, col_b) VALUES (...)`
  • Multiple tuples in one statement, separated by commas
  • Quoted strings with escaped `''` quotes
  • `NULL`, `TRUE`, `FALSE` and numeric literals

What it does not do

It is a parser, not a database. JOINs, subqueries, functions, `DEFAULT` and `ON CONFLICT` clauses are outside its scope. Split large dumps so each INSERT statement can be converted on its own.

How to convert

  1. 1Copy one INSERT statement from the dump.
  2. 2Paste it into the SQL to JSON tool.
  3. 3Convert — you get an array with one object per tuple.
  4. 4Save the array as a fixture file and load it in your tests.
Values keep their SQL types: numbers become numbers, quoted text becomes a string, NULL becomes null. Dates stay strings, so parse them explicitly.

Frequently asked questions

Why did it reject my statement?

Only INSERT statements are supported. `CREATE TABLE`, `UPDATE` and `DELETE` have no row data to convert.

Can I convert a whole dump at once?

Convert one statement at a time and merge the arrays. A dump usually contains schema changes that would break a single parse.

Are column names preserved?

Yes — the column list in the statement becomes the object keys, in the same order.

Do it now — free, no signup

Keep reading

Last updated 10 November 2026. Files processed by FilePlume are deleted automatically; nothing is used for training.