JSON to 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?
How to Use
- Paste a JSON array of objects in the input panel (each object becomes a row)
- Set the table name (defaults to data)
- Click Generate SQL or press Ctrl+Enter
- Copy the SQL or download as a
.sqlfile - 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 →
NULLin INSERT,TEXTcolumn type - JSON object or array → serialized as JSON string in a
TEXTcolumn - 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