JSON to SQL

Input
Output

JSON to SQL Converter

Turn an array of JSON records into a CREATE TABLE statement with sensible column types, plus INSERT statements ready to run. Nested objects become JSON columns.

Example: loading user records into PostgreSQL

Two user records with a date, a boolean, a decimal, a null and a nested object. Each column gets a type that fits every value in it, the date becomes TIMESTAMP, the nested object a JSONB column, and the apostrophe in O'Neil is escaped:

Input

[
  {
    "id": 1,
    "email": "[email protected]",
    "name": "Ananya Rao",
    "signup": "2026-10-01T09:30:00Z",
    "active": true,
    "score": 4.5,
    "meta": {
      "plan": "pro"
    }
  },
  {
    "id": 2,
    "email": "[email protected]",
    "name": "Kabir O'Neil",
    "signup": "2026-10-12T14:05:00Z",
    "active": false,
    "score": null,
    "meta": {
      "plan": "free"
    }
  }
]

Output

CREATE TABLE "users" (
  "id" INTEGER,
  "email" TEXT,
  "name" TEXT,
  "signup" TIMESTAMP,
  "active" BOOLEAN,
  "score" DOUBLE PRECISION,
  "meta" JSONB
);

INSERT INTO "users" ("id", "email", "name", "signup", "active", "score", "meta") VALUES
  (1, '[email protected]', 'Ananya Rao', '2026-10-01T09:30:00Z', TRUE, 4.5, '{"plan":"pro"}'),
  (2, '[email protected]', 'Kabir O''Neil', '2026-10-12T14:05:00Z', FALSE, NULL, '{"plan":"free"}');

How do I use the JSON to SQL?

  1. Paste an array of objects.
  2. Set the table name and pick PostgreSQL, MySQL or SQLite.
  3. Copy the SQL and run it.

What does the JSON to SQL do?

  • Column types guessed from your data
  • Batched or one-per-row INSERTs
  • Nested objects stored as JSON columns

When to use the JSON to SQL

Getting JSON into a database usually means writing a CREATE TABLE by hand and then an INSERT for every record. Paste the records instead and get both, ready to run in psql, the MySQL client, sqlite3 or a database GUI, for seeding a test database, loading an export or trying out queries on real data.

Each column's type is chosen to fit every value in it: whole numbers become INTEGER, decimals DOUBLE PRECISION (DOUBLE in MySQL, REAL in SQLite), true and false BOOLEAN, ISO date-times TIMESTAMP, and nested objects a JSON column (JSONB in PostgreSQL, JSON in MySQL, TEXT in SQLite). Names are quoted the way each database expects, quotes inside strings are doubled, and null becomes NULL. Inserts come in batches of up to 100 rows, or one statement per row if your tool prefers that.

Frequently asked questions

Why is a date column TEXT or VARCHAR?
Only full ISO date-times like 2026-10-01T09:30:00Z become TIMESTAMP. A plain date such as 2026-10-01 is kept as text so nothing is lost; change the column type after creating the table if you want a DATE.
Can I query the JSON with SQL without a database?
Yes. The SQL tool runs SELECT queries directly on your JSON in the browser, with WHERE, GROUP BY, ORDER BY and aggregates.
Can I query JSON with SQL instead?
Yes. The SQL tool runs SELECT queries directly on your JSON.
Is my data uploaded?
No. Bracely runs entirely in your browser, so nothing you paste or open leaves your device.

More JSON tools

Bracely has 108 JSON tools in one page. Related ones:

Runs entirely in your browser. Nothing you paste is uploaded. Made by Saurabh Pagrut · About · Privacy policy
Last updated · Version 6.7 · Changelog
Saurabh Pagrut on GitHub · LinkedIn · X · YouTube · Instagram