AZ Tools

JSON → SQL INSERT

Convert

Pastes a JSON array (or a single object) and emits a ready-to-run SQL insert. Columns are the union of all keys; rows missing a column get NULL. Strings are single-quote escaped, numbers and booleans become literals, nested objects / arrays get serialized to JSON. Optional `ON CONFLICT` (Postgres / SQLite) or `ON DUPLICATE KEY UPDATE` (MySQL) so you can drop the output straight into a sync job.

SQL(3)
INSERT INTO "users" ("id", "name", "email", "verified", "joined")
VALUES
  (1, 'Alice', 'alice@example.com', TRUE, '2024-01-15'),
  (2, 'Bob', 'bob@example.com', FALSE, '2024-03-22'),
  (3, 'Carol', NULL, TRUE, '2024-06-01');

Strings are escaped by doubling single quotes — safe for all four dialects.

How to use

  1. Paste a JSON array of objects (or a single object).
  2. Set the table name and SQL dialect.
  3. Toggle multi-row VALUES for a single statement, or off for one INSERT per row. Toggle upsert if you want ON CONFLICT / ON DUPLICATE KEY UPDATE.

Frequently asked questions

How are nested objects handled?
Serialized to JSON and inserted as a quoted string. PostgreSQL and MySQL columns of type `JSON` / `JSONB` accept these directly; for SQLite they go in as TEXT.
What's the difference between multi-row and one INSERT per row?
Multi-row produces a single `INSERT INTO ... VALUES (…), (…), (…);` which runs much faster on bulk loads. Per-row produces N statements — handier when you want to comment out individual rows or expect failures to be partial.

Related tools