JSON to SQL Converter Online

Turn an array of JSON objects into CREATE TABLE and INSERT statements for MySQL, PostgreSQL, SQLite or SQL Server, with types inferred from every row.

How to Convert JSON to SQL

Paste a JSON array, choose a dialect and a table name, then copy the generated script or download it as a .sql file.

步驟 1

Paste Your Array

Each object becomes one row in the generated table.

步驟 2

Choose a Dialect

Pick MySQL, PostgreSQL, SQLite or SQL Server syntax.

步驟 3

Run the Script

Copy the SQL or download it and execute it directly.

Seed a Relational Table From JSON Without Writing the Insert Statements

Relational databases want rows and columns; APIs and document stores hand you nested JSON. Between those two shapes sits a tedious hour of writing a CREATE TABLE statement by hand and then an INSERT for every record, which is exactly the kind of work a converter should be doing for you. Paste an array of objects, name the table, and the script comes out ready to run against a fresh database.

Each object becomes a row and each key becomes a column, but the interesting part is type inference. Reading the first row is the easy way and the wrong one: a column holding integers in nine records and a decimal in the tenth needs a floating-point type, or the import fails partway through. This tool scans every row before deciding, so the generated schema matches the data rather than a sample of it, which is the difference between an import that finishes and one that fails on row nine hundred.

Dialect matters more than it looks. MySQL quotes identifiers with backticks, PostgreSQL and SQLite with double quotes, and SQL Server with square brackets, and each engine has its own names for boolean and text types. Choosing the dialect up front means the output runs as written in your client instead of producing a syntax error on the first reserved word it happens to meet in your data.

Identifiers are always quoted, which is deliberate. Keys like order, user, key or group are reserved somewhere, and a space or a capital letter in a key breaks an unquoted name just as reliably. String values are escaped per dialect rules as well, so an apostrophe inside a name cannot terminate the statement early and corrupt everything that follows it in the import.

The generated script is a starting point, not a finished schema. It will not add primary keys, indexes, foreign keys or constraints, because those are decisions a converter cannot guess from a single document. Review the output, tighten the types to what you know each column should hold, and then run it. Everything is generated in your browser, so the data never leaves the tab.

Four Dialects

MySQL, PostgreSQL, SQLite and SQL Server dialects are all supported.

Row Wide Types

Columns are typed from every row, not just the first one.

Create Table Option

Emit a matching CREATE TABLE statement above the insert rows.

Safe Identifiers

Quoting follows the dialect, so reserved words still parse fine.

Escaped Strings

Quotes and backslashes are escaped according to each dialect's own rules.

複製或下載

Take the script to your database client or save a .sql file.

常問問題

常見問題解答

Yes. There is no account, no row limit and no watermark in the generated script. Convert as much data as you need at no cost, with the site funded by light display advertising rather than a subscription or a paid export tier.

MySQL, PostgreSQL, SQLite and SQL Server. Each uses its own identifier quoting and its own type names, so picking the right one up front means the script runs in your client as written rather than needing manual corrections afterwards.

Every row is scanned before a type is chosen, not just the first. A column of integers with one decimal becomes a floating-point type, booleans map to the dialect’s boolean type, and text becomes a wide text column that no later value can overflow.

Yes, if you leave the option on. The schema is emitted above the insert statements, so the whole script can run in one pass against an empty database. Switch it off when the table already exists and you only need the rows.

Yes. The default produces a single multi-row insert, which imports faster, and the option splits it into one statement per record when you need individual statements for a migration file, a review or a debugging session.

Always. Keys such as order, user or key are reserved words in at least one engine, and a space or a capital letter breaks an unquoted name too. Quoting follows the dialect, so the same data produces backticks, double quotes or brackets as needed.

Quotes and backslashes are escaped following the rules of the chosen dialect, so an apostrophe inside a value cannot end the statement early and corrupt everything after it. Numeric and boolean values are written unquoted so they keep their type.

No. Type inference and statement generation run in JavaScript inside your browser, and no request carries your data. That matters because these documents are frequently exports of customer records or internal tables you would not want on someone else’s server.

It is a solid first draft, not a finished design. The converter cannot know which column is a primary key, which needs an index, or which references another table, so review the types and add constraints before relying on it in production.