JSON to SQL Converter
Paste a JSON array of objects and get SQL INSERT statements, with correct quoting, typed columns, and an optional CREATE TABLE.
Object keys become columns. The SQL updates live as you type and nothing is uploaded.
Options
SQL dialect
Statement style
Schema
How to convert JSON to SQL insert statements
Paste your JSON array
Drop in an array of objects. Each object becomes one row and each key becomes a column.
Set the table and dialect
Name the target table and pick MySQL, PostgreSQL, SQLite, or SQL Server so identifiers and column types match.
Choose the statement style
Use one multi-row INSERT for a compact script, or one statement per row, and turn on CREATE TABLE if you need the schema too.
Copy the SQL
The script updates live as you type, so copy it or download it as a .sql file.
Why use this tool
Four dialects
Identifiers are quoted with backticks for MySQL, double quotes for PostgreSQL and SQLite, or square brackets for SQL Server, and the inferred column types follow the same choice.
Types stay types
Numbers, booleans, and null are emitted unquoted and in the form each dialect expects, while text is quoted with any embedded quote doubled so a quote in the data cannot break the statement.
Uneven rows line up
Objects with different keys produce the union of every column, and rows that are missing one get NULL for it, with a note listing which columns were filled in.
Nested values handled
An object or an array inside a row is stored as JSON text in a single column, typed as JSON, JSONB, or a wide text column depending on the dialect.
Optional CREATE TABLE
Turn on schema output to prepend a CREATE TABLE with a type inferred per column, covering integers, decimals, booleans, dates, timestamps, JSON, and sized text.
Your data stays on your device
The whole conversion happens in your browser, so an export full of customer records is never uploaded anywhere.
About this tool
This tool turns a JSON array of objects into a runnable SQL script. Every object is one row, every key is a column, and the value types survive the trip: whole numbers and decimals are written unquoted, booleans use the form the chosen dialect understands, null stays NULL, and text is single quoted with any embedded quote doubled so an apostrophe in a name cannot end the statement early.
Real exports are rarely tidy, so the awkward cases are handled deliberately. When rows do not all share the same keys, the column list is the union of every key seen and the gaps are filled with NULL, with a note telling you which columns that applied to. An object or an array nested inside a row is serialized into one JSON text column rather than being flattened or dropped. Key names are sanitized into valid identifiers, duplicates after sanitizing are given a numeric suffix, and a table name written as schema.table is quoted one segment at a time.
Pick the dialect and both the quoting and the generated types follow: backticks and INT for MySQL, double quotes and INTEGER for PostgreSQL, storage class names for SQLite, and square brackets with NVARCHAR for SQL Server. Multi-row inserts are grouped 100 rows at a time, which stays under the limit SQL Server enforces, and very large inputs stop at the first 20,000 rows with a note. Invalid JSON, a bare object, or an array of plain values each get a specific error rather than an empty output. To come at the same job from a spreadsheet, use CSV to SQL, and once you have a script the SQL formatter can re-indent it to your house style. Going the other way, JSON to CSV flattens the same array for a spreadsheet.
Frequently asked questions
- What shape does the JSON need to be?
- An array of objects, such as [{"id": 1, "name": "Ada"}, {"id": 2, "name": "Grace"}]. A single object on its own, an array of plain values, or invalid JSON each show a specific error explaining what to change.
- Which SQL dialects are supported?
- MySQL, PostgreSQL, SQLite, and SQL Server. The dialect controls how identifiers are quoted, how booleans are written, and which type names appear in the optional CREATE TABLE, such as INT versus INTEGER or NVARCHAR versus VARCHAR.
- How are quotes and special characters escaped?
- Text values are wrapped in single quotes and every single quote inside is doubled, which is the standard SQL escape, so a surname with an apostrophe or a quoted phrase stays intact. For MySQL, backslashes are doubled as well, since MySQL treats them as escape characters.
- What happens to rows with different keys?
- The column list is the union of every key across all rows, in the order the keys first appear. Any row missing a column gets NULL for it, and a note under the output lists which columns were filled in that way.
- What happens to nested objects and arrays?
- They are serialized into a JSON string and stored in a single column, typed as JSON for MySQL, JSONB for PostgreSQL, and a wide text column for SQLite and SQL Server. A note lists which columns hold nested values.
- Is my data uploaded anywhere?
- No. The conversion runs entirely in your browser. Your JSON never leaves your device, is never sent to a server, and is not stored or logged.
Related tools
CSV to SQL Insert
Paste CSV or TSV and get ready-to-run SQL INSERT statements, with header-based columns, smart value quoting, and an optional CREATE TABLE.
SQL Formatter & Beautifier
Beautify SQL queries with dialect-aware formatting, keyword casing, and indent control.
JSON to CSV
Flatten a JSON array of objects into clean CSV, with nested keys expanded to dotted columns and your choice of delimiter.
API Key Generator
Generate cryptographically random API keys and tokens in hex, base62, or base64url, with control over length, an optional prefix, and bulk output.
ASCII Table Reference
The full ASCII character set with decimal, hex, octal, binary, and HTML codes. Search by code, character, or name.
Atbash Cipher
Mirror the alphabet so A swaps with Z, B with Y, and so on. Atbash is its own inverse, so one field both encodes and decodes as you type.