JSON to SQL Insert

SQL Tools

Generate INSERT statements from a JSON array of objects.

Runs entirely in your browser โ€” nothing is uploaded

What people do next

Features

  • One multi-row INSERT, or one statement per record.
  • Optional upsert with ON CONFLICT DO UPDATE.
  • Identifiers quoted correctly for the dialect you pick.
  • Strings escaped, numbers and booleans left unquoted, missing keys written as NULL.
  • Generated in your browser โ€” the data never leaves your machine.

How to use the JSON to SQL Insert

  1. 1Paste a JSON array of objects.
  2. 2Set the table name and the dialect.
  3. 3Copy the generated INSERT statements.

Frequently asked questions

What if objects have different keys?

The column list is the union of every key found, and any record missing one of them gets NULL in that position. That keeps a single multi-row INSERT valid, which is what you want โ€” the alternative is a statement per record, which the style toggle offers.

One big INSERT or one per row?

A single multi-row INSERT is considerably faster to execute, because the database parses one statement instead of hundreds. One statement per row is easier to read, easier to comment out selectively, and survives a partial failure more gracefully. Use multi-row for seeding and single-row when a human will edit the file.

How are quotes in the data handled?

Single quotes inside a string are doubled, which is the standard SQL escape. That means a value like O'Brien is written as 'O''Brien' and inserts correctly rather than terminating the literal early.

What does the upsert option generate?

An ON CONFLICT (key) DO UPDATE SET โ€ฆ clause that updates every non-key column with the incoming value. It is the right shape for re-runnable seed data: running the script twice leaves one row rather than failing on a duplicate key or creating a second copy.

Are nested objects supported?

Not as columns. A nested object or array has no natural column to go in, so flatten the JSON first, or store the nested part in a JSON column and insert it as a string.