JSON to SQL Converter

Paste an array of JSON objects, such as an API response or an export from MongoDB or Firebase, and get INSERT statements plus a CREATE TABLE. Columns come from every key that appears in any object, missing keys become NULL, and nested objects or arrays are stored as JSON text (JSONB in PostgreSQL, JSON in MySQL).

Input
Database

1 writes one statement per row.

3 rows in 1 INSERT. Columns: id INTEGER, name TEXT, city TEXT, amount NUMERIC, paid BOOLEAN, tags JSONB

SQL generation runs in your browser. What you type never leaves this device.

Features

  • Columns are the union of keys across all objects, in the order they first appear

  • Real JSON types are kept: numbers stay numbers, true/false become booleans, null stays NULL

  • Nested objects and arrays go into a JSONB, JSON or NVARCHAR(MAX) column as JSON text

  • Accepts a bare array, a single object, or a wrapper like {"data": [ ... ]}

  • Batch size, transaction wrapping and identifier quoting per database

  • Clear error messages with the parser's reason when the JSON is invalid

Where it helps

Saving an API response

Copy a list of orders or users from Postman or your browser's network tab and load it into a local table to query it with SQL.

Moving from a document store

Export a collection from MongoDB or Firestore as JSON and create a first relational table from it, nested fields included.

Fixtures for tests

Keep test fixtures as readable JSON and generate the SQL to load them when the test database starts.

How JSON maps to rows

One object, one row

Each object in the array becomes a row and each key becomes a column. If the second object has a key the first one lacks, the column is still created and earlier rows get NULL for it.

Types

  • Whole numbers become INTEGER or BIGINT, other numbers DECIMAL.
  • Strings that look like 2026-11-02 or an ISO timestamp become DATE or TIMESTAMP columns.
  • Objects and arrays become JSON text. In PostgreSQL you can query them with ->> once they are in a JSONB column.
  • A key whose values mix kinds (a number in one row, text in another) becomes a text column.

Flatten first if you need columns

If you would rather have address.city as its own column than a JSON blob, flatten the objects to dot-path keys first, then convert.

JSON to SQL Converter - FAQ