Zero Signup ToolsFree browser tools

Converter Tools

JSON to SQL Converter

Convert JSON to SQL INSERT statements for MySQL, PostgreSQL, SQLite, and SQL Server. Multi-row, batched, or one per row, with CREATE TABLE inference.

Dialect

Output mode

Use schema.table to qualify. Identifiers are quoted automatically when they need it.

Nested objects and arrays

Nested objects/arrays expand into address.city, tags[0], ...

Conversion runs entirely in your browser. The JSON you paste is never uploaded.

How JSON values become SQL

  • JSON strings are wrapped in single quotes and any inner ' is doubled, the portable form across every major dialect.
  • JSON numbers pass through as bare SQL literals. NaN and Infinity become NULL because no portable SQL form exists.
  • JSON booleans become TRUE / FALSE on MySQL, PostgreSQL, and Standard SQL, and 1 / 0 on SQLite and SQL Server.
  • JSON null becomes SQL NULL.
  • Nested objects and arrays either flatten into dotted columns (address.city, tags[0]) or become a single JSON string in one cell, depending on the toggle above.
  • Missing keys in a row become NULL so the column count stays uniform across the full VALUES list.

Identifier quoting and reserved words

Table and column names are quoted automatically when they contain characters outside [A-Za-z0-9_], start with a digit, or match a reserved word like select or user. Each dialect uses its native quoting style: backticks on MySQL, double quotes on PostgreSQL, SQLite, and Standard SQL, and square brackets on SQL Server. Bare identifiers stay unquoted so the output looks like a human wrote it.

CREATE TABLE inference

With CREATE TABLE prepended, the tool walks every row and picks the most permissive type that fits the observed values. INTEGER promotes to DOUBLE when a row has a decimal, DATE promotes to DATETIME when a row has a time component, and any column with a mixed shape falls back to TEXT. NULLs do not narrow the type. Treat the prelude as a starting point: production schemas usually need NOT NULL, primary keys, and indexes you add by hand.

Privacy and performance

Parsing uses the browser's native JSON.parse and emission is a single pass over the row list. Inputs up to two million characters convert in a fraction of a second on modern devices. The JSON you paste is never sent to a server.

How to use

  1. Paste a JSON array of objects, a single object, or an envelope like {"data": [...]} into the input.
  2. Pick the dialect (MySQL, PostgreSQL, SQLite, SQL Server, or Standard SQL) and enter the target table name.
  3. Choose multi-row VALUES, one INSERT per row, or batched chunks of N. Batched is best for very large datasets.
  4. Decide whether nested objects and arrays should flatten into dotted columns or become a single JSON string per cell.
  5. Toggle Prepend CREATE TABLE for an inferred schema, then click Copy SQL and paste into your database client.

About this tool

JSON to SQL Converter takes a JSON array of rows and emits one or more SQL INSERT statements ready to paste into your database client. It accepts the four shapes that real-world data lands in: an array of objects (the canonical case), a single object treated as a one-row insert, an envelope object whose first array property holds the rows (the {"data": [...]} shape that most REST APIs return), and an array of arrays for positional rows with an optional header row at the top. The dialect selector targets MySQL (backtick identifiers, TRUE/FALSE booleans), PostgreSQL (double-quote identifiers, TRUE/FALSE), SQLite (double-quote identifiers, 1/0 booleans), SQL Server (square bracket identifiers, 1/0 booleans), and Standard SQL. Identifiers are quoted automatically when they contain characters outside [A-Za-z0-9_], start with a digit, or match a reserved word like select or user, so the output never breaks on a column named order or table. String literals always use single quotes with doubled embedded quotes, the portable form every major dialect accepts. JSON null becomes SQL NULL, booleans become TRUE/FALSE or 1/0 depending on dialect, numbers pass through as bare scalars, and NaN or Infinity collapse to NULL because no portable SQL form exists. Nested objects and arrays can either flatten into dotted columns (address.city, tags[0]) so spreadsheets and traditional schemas consume them cleanly, or stringify into a single JSON-typed column for Postgres jsonb / MySQL JSON fields. Output mode controls whether you get a single multi-row VALUES list, one INSERT per row for maximum portability, or batched chunks of N rows that suit very large datasets. An optional CREATE TABLE prelude walks every row to infer column types: INTEGER, DOUBLE, BOOLEAN, DATE, DATETIME, or TEXT, mapped to the right native type for the selected dialect, with promotion rules so a column that has both 1 and 1.5 becomes DOUBLE and a column with mixed shape falls back to TEXT. Useful for seeding a dev database from an API response, converting JSON fixtures into SQL migrations, building seed scripts from mock data, importing JSON into Postgres or MySQL without a custom loader script, and quickly prototyping a schema from a sample payload. Everything runs locally in your browser; the JSON you paste is never uploaded.

Free to use. Works in your browser. No signup, no login.

Related tools

You may also like

All tools
All toolsConverter Tools