JSON to SQL

FreePrivateInstant
JSON input
SQL output
Ctrl+Enter Generate SQL

JSON to SQL Generator

Paste a JSON array and get a CREATE TABLE statement with inferred column types, plus one INSERT INTO statement per row. Handles strings, integers, floats, booleans, and nulls. Compatible with PostgreSQL, MySQL, and SQLite. Runs entirely in your browser.

Where Is This Useful?

Seeding a database from JSON
Have fixture data or a test dataset in JSON? Convert it to SQL and run it directly against your database to seed it without writing INSERT statements by hand for every row.
Migrating from a NoSQL or API source
Exporting data from MongoDB, Firebase, or a third-party API often gives you JSON. Convert it to SQL insert statements to load the data into a relational database as part of a migration.
Rapid schema prototyping
Want to quickly stand up a table for a proof of concept? Paste a sample JSON document and get the CREATE TABLE statement with column names and types without writing SQL from scratch.

How to Use

  1. Paste a JSON array of objects in the input panel (each object becomes a row)
  2. Set the table name (defaults to data)
  3. Click Generate SQL or press Ctrl+Enter
  4. Copy the SQL or download as a .sql file
  5. Run against your database — adjust column types and add constraints as needed

Type Mapping

  • JSON string → TEXT
  • JSON integer → INTEGER
  • JSON float → REAL
  • JSON boolean → BOOLEAN
  • JSON null → NULL in INSERT, TEXT column type
  • JSON object or array → serialized as JSON string in a TEXT column
  • Single quotes in strings escaped as ''

Frequently Asked Questions

Which SQL dialect does this use?

Standard SQL types: TEXT, INTEGER, REAL, BOOLEAN. Compatible with PostgreSQL, MySQL, SQLite, and most relational databases.

What if the JSON is a single object?

A single object is treated as a one-row array. You get a CREATE TABLE and one INSERT INTO statement.

How are nested objects handled?

Nested objects and arrays are serialized as JSON strings in a TEXT column. For relational normalization, split them into separate tables manually.

Are string values safely escaped?

Yes. Single quotes inside strings are doubled (''), which is the standard SQL escaping method.

Can I also go the other way?

Not directly — SQL to JSON is harder because SQL is a query language, not a data format. But you can use the JSON to Prisma Schema tool to model the data for a modern ORM instead.

Is my JSON uploaded anywhere?

No. Everything runs locally in your browser. Your data never leaves your machine.

Related Tools