JSON to SQL
Convert JSON arrays into INSERT statements and CREATE TABLE DDL
How to use
- Paste a JSON object or an array of objects into the input pane. Arrays produce one INSERT per element.
- Pick your SQL dialect: MySQL, PostgreSQL, or SQLite.
- Optionally change the table name (defaults to my_table).
- Copy the CREATE TABLE statement and the INSERT statements from the output pane.
About this tool
Converting JSON exports from APIs or NoSQL databases into relational INSERT scripts is a common chore when seeding test databases or migrating data. This converter handles the two annoying parts automatically: type inference from sample values, and correct quoting per dialect. Column order follows the first-seen key order across all rows, and rows missing a key simply get NULL.
Frequently asked questions
How are column types decided?
Each column's type is inferred from its values: integers become BIGINT/INTEGER, decimals become DOUBLE/DOUBLE PRECISION/REAL, booleans become BOOLEAN (or TINYINT(1) on MySQL), and mixed-type or null-only columns fall back to TEXT.
What happens to nested objects and arrays?
Nested structures are stored as compact JSON strings in a JSON/TEXT column, with inner quotes escaped by doubling them, which is valid in all three dialects.
Are identifiers and strings escaped safely?
Yes. Column and table names are quoted with backticks (MySQL) or double quotes (PostgreSQL/SQLite), and single quotes inside strings are doubled. Generated SQL is safe to run as-is.
Is my data uploaded anywhere?
No. The conversion runs entirely in your browser using JavaScript. Nothing is sent to any server, which makes it safe for production data and personal information.