JSON to SQL Converter

Generate INSERT statements, and optionally CREATE TABLE, from a JSON array of objects.

100% Client-Side Processing — your data never leaves this browser. Works offline. How it works

0 lines • 0 bytes Ready
Tip: drop a file anywhere on the editor
Input
Paste, type or drop a file
1
Result
Updates as you type
// Output will appear here…
About this tool

How the JSON to SQL works

Convert a JSON array of objects into SQL INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server. Nested values are stored as JSON text or flattened.

How to use the JSON to SQL

  1. Paste a JSON array of objects (or an API response containing one).
  2. Set the table name and SQL dialect; choose how nested objects are stored.
  3. Copy the INSERT statements or download them as a .sql file.

JSON to SQL example

Input
[{"id":1,"name":"Aarav","vip":true},{"id":2,"name":"Sara O'Neil","vip":false}]
Result
INSERT INTO "customers" ("id", "name", "vip") VALUES
  (1, 'Aarav', TRUE),
  (2, 'Sara O''Neil', FALSE);

When to use it

  • Loading API responses into a database for analysis.
  • Creating seed data from JSON fixtures.
  • Moving data from a NoSQL export into a relational database.

Tip: If records have different keys, every key still becomes a column; check the NOT NULL constraints in CREATE TABLE before running it.

Finds your records

Paste an array, or an API response such as {"users": [...]}; the first array of objects is used and its key becomes the default table name.

Every key becomes a column

Keys are collected from all objects, so records with missing fields still line up and the gaps become NULL.

Nested objects handled

Store nested objects and arrays as JSON text (ideal for JSON/JSONB columns), or flatten them into columns like address.city.

Dialect-correct output

Identifier quoting, TRUE/FALSE vs 1/0 and column types match the database you choose.

FAQ

Common questions

What JSON shape does it expect?

An array of objects works best. An object that contains an array of objects (a typical API response) also works, and a single object becomes one row.

How are nested objects stored?

By default as a JSON string, which suits MySQL JSON and PostgreSQL JSONB columns. Turn on "Flatten nested objects" to create one column per nested field instead.

Can it create the table too?

Yes. Tick "Add CREATE TABLE" to get a table definition with types detected from the data before the INSERT statements.

Is the data sent anywhere?

No. The SQL is generated in your browser.