Skip to content

JSON to SQL Insert

Turn an array of JSON records into INSERT statements, with an optional CREATE TABLE.

Quick Tool Overview

The JSON to SQL Insert converter turns an array of records into INSERT statements, with columns taken from the union of every record's keys, proper quote escaping, and an optional CREATE TABLE with inferred column types.

What it does
Generates SQL INSERT statements from a JSON array
You give it
An array of flat JSON objects
You get back
INSERT statements, optionally with a CREATE TABLE
Best for
Seeding a database from an export or an API response
Developer Tools Free, unlimited use No sign-up Runs in your browser

About the JSON to SQL Insert

Paste an array of records and get the INSERT statements to load them. Columns are taken from the union of every record's keys, so a row missing a field gets NULL in that column rather than shifting the values along.

The escaping is the part that matters. Single quotes inside a value are doubled, numbers and booleans are written unquoted in the form the chosen dialect accepts, nulls become the NULL keyword rather than the string "null", and nested objects are serialised back to JSON text for a JSON column. You can emit one statement per row or a single multi-row insert, which is dramatically faster for a bulk load, and optionally a CREATE TABLE with column types inferred from the data.

Key features of the JSON to SQL Insert

Missing keys become NULL

Columns come from the union of every record, so a row that omits a field gets NULL rather than shifting the other values along.

Correct escaping

Single quotes inside values are doubled, the SQL-standard escape that works in MySQL, PostgreSQL and SQLite alike.

Types written properly

Numbers and booleans are unquoted in the form the chosen dialect accepts, and null becomes the NULL keyword rather than the string "null".

Batched or single

One multi-row INSERT for a fast bulk load, or a statement per row when you need to run them selectively.

Optional CREATE TABLE

Column types are inferred from the sample — BIGINT, DOUBLE, BOOLEAN, TIMESTAMP or VARCHAR — as a starting point you can adjust.

How to use the JSON to SQL Insert

  1. 1

    Paste a JSON array

    An array of flat objects — one object per row you want inserted.

  2. 2

    Name the table

    Set the target table name and pick your SQL dialect.

  3. 3

    Choose the statement style

    One INSERT per row for readability, or a single batched insert for speed.

  4. 4

    Copy into your client

    Run the statements, adding the CREATE TABLE first if the table does not exist yet.

Frequently asked questions

They are serialised back to a JSON string, which is what a JSON or TEXT column expects. Flatten the document first with the JSON Flattener if you want one column per leaf instead.

Reviews of the JSON to SQL Insert

What people who use the JSON to SQL Insert think of it. Reviews come from visitors and are posted as written.

No ratings yet

Yours would be the first.

  • 5 0 reviews rated 5 stars
  • 4 0 reviews rated 4 stars
  • 3 0 reviews rated 3 stars
  • 2 0 reviews rated 2 stars
  • 1 0 reviews rated 1 star

Write a review

Used this tool? Your rating helps the next person decide.

Your rating

Plain text only — links, email addresses and HTML are not accepted. Your name and review are shown publicly; nothing else is collected. See the privacy policy.

0 reviews

Newest first

No reviews yet

Be the first to rate the JSON to SQL Insert. It takes half a minute and no account.

Write the first review

More developer tools