JSON WalletPrivacy-first JSON & API workspace

JSON to SQL

Turn a JSON object or an array of objects into a CREATE TABLE schema plus INSERT statements. Column types are inferred from your data. Pick your database dialect below.

Input
SQL

Generate SQL from JSON

Loading a JSON payload into a relational database usually means writing a CREATE TABLE by hand and then hand-crafting every INSERT — tedious and easy to get wrong. Paste an array of JSON objects and this tool infers a column for each key, picks a sensible type from the values it sees, and emits a schema plus one insert per row. Choose MySQL, PostgreSQL, SQL Server, SQLite or Oracle and the identifier quoting and type names match that database.

How to use it

  1. Paste a JSON object, or better an array of objects, into the input box.
  2. Set the Table name and choose your Dialect.
  3. Copy the generated CREATE TABLE and INSERT statements on the right.

A worked example

This JSON array:

[
  { "id": 1, "name": "John", "active": true },
  { "id": 2, "name": "Alice", "active": false }
]

produces (MySQL):

CREATE TABLE `my_table` (
  `id` INT,
  `name` VARCHAR(255),
  `active` TINYINT(1)
);

INSERT INTO `my_table` (`id`, `name`, `active`) VALUES (1, 'John', 1);
INSERT INTO `my_table` (`id`, `name`, `active`) VALUES (2, 'Alice', 0);

The union of all keys across the array becomes the column list, so objects missing a field simply insert a NULL in that column.

When you would reach for it

Seeding a development database from an API response, importing a JSON export into reporting tables, or turning a fixture into test data. If you need a spreadsheet instead of a database, use JSON to CSV; to model the same data as typed classes, see JSON to Java.

Privacy

SQL generation runs entirely in your browser and works offline once loaded. Your JSON is never uploaded or stored, so it is safe to paste real records.

Frequently asked questions

Can I insert many rows at once?

Yes — paste an array of objects and you get one INSERT per row plus a single CREATE TABLE based on the union of all keys.

How are nested objects handled?

Nested objects and arrays are stored as JSON strings in a text column. Flatten your data first if you want separate columns, or keep them as JSON and query with your database's JSON functions.

Which column types are inferred?

Strings become VARCHAR/TEXT, whole numbers become integer types, decimals become floating-point or NUMERIC, booleans map to the dialect's boolean (or TINYINT/BIT where there is none), and nulls widen a column to be nullable. Review and tighten the types before running in production.

What is different between the dialects?

Identifier quoting, boolean handling and a few type names differ. MySQL uses backticks, PostgreSQL and standard SQL use double quotes, SQL Server uses brackets. Pick the target database so the generated DDL runs without edits.

Are my values escaped safely?

String values are single-quoted with embedded quotes doubled, so text containing apostrophes is inserted correctly. Still review generated SQL before running it against a real database.

Is my JSON uploaded?

No. The SQL is generated entirely in your browser — nothing is sent to a server.

Press ⌘ K for commands