Omnikit
DevFilesMoneyAll tools
Ctrl K
Dev toolsFile toolsMoney calculatorsAll tools
HomeDeveloper toolsJSON to SQL Converter

JSON to SQL Converter

dev

JSON to CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQLite or SQL Server

Runs in your browser. Nothing you type is sent anywhere. Checked against sources on 17 Oct 2026.

Paste a JSON array or a CSV and get a CREATE TABLE with inferred column types plus INSERT statements for PostgreSQL, MySQL, SQLite or SQL Server. Quotes, backslashes and reserved column names are escaped the way each database needs, and rows are batched 100 per statement by default.

Next:
  • SQL Formatter Format and beautify SQL for PostgreSQL, MySQL, SQL Server and more
  • SQL to JSON Converter Turn SQL INSERT statements or a database dump into JSON or CSV, table by table

How to convert JSON to SQL INSERT statements

1

Paste a JSON array of objects, or a CSV with a header row, or press Try an example.

2

Choose the database: PostgreSQL, MySQL, SQLite or SQL Server, and type the table name.

3

Read the CREATE TABLE with the inferred column types and the INSERT statements below it.

4

Press Copy, or Download the .sql file, and run it in your database.

About JSON to SQL Converter

Seeding a test database, loading an API response for analysis or moving a spreadsheet into a table all start with the same chore: writing a CREATE TABLE and a pile of INSERT statements. This page writes both from the data itself.

Column types are worked out from the values.

Values in the column PostgreSQL MySQL SQLite SQL Server
Whole numbers INTEGER or BIGINT INTEGER or BIGINT INTEGER INTEGER or BIGINT
Decimals NUMERIC DOUBLE REAL FLOAT
true / false BOOLEAN BOOLEAN BOOLEAN BIT
2026-10-17 DATE DATE TEXT DATE
Objects or arrays JSONB JSON TEXT NVARCHAR(MAX)
Text TEXT VARCHAR(255) or TEXT TEXT NVARCHAR(255) or larger

A column with no empty values gets NOT NULL, and an integer column named id with unique values becomes the PRIMARY KEY. A column mixing numbers and text is stored as text, and the page says so.

Escaping that differs by database. A single quote is doubled everywhere. MySQL also treats a backslash as an escape character, so backslashes are doubled for MySQL and only there. SQL Server gets an N prefix on text with non-ASCII characters so Hindi or emoji survive. Reserved or mixed-case column names are quoted with double quotes, backticks or brackets as each database expects.

Batching. Rows are grouped 100 per INSERT by default; set 1 for one statement per row. SQL Server allows at most 1,000 rows in one VALUES list, so larger batches are capped there.

How it was checked. The output for 15 test cases, covering quotes, backslashes, emoji, reserved names, nested JSON, nulls, big integers and timestamps, was run in PostgreSQL 17 and SQLite 3.35, and the rows each engine read back equal the input. Nothing you paste leaves your browser. To go the other way, from INSERT statements back to JSON, use SQL to JSON.

Frequently asked questions

How do I insert JSON data into a SQL table?

Paste the JSON array here, choose your database and copy the script: a CREATE TABLE with a column per key, then INSERT statements with every value escaped. Run the script in psql, the MySQL client, sqlite3 or SQL Server Management Studio. Nested objects and arrays go into a JSON or text column.

How are column types chosen from JSON?

Each column is typed from all of its values: whole numbers become INTEGER, or BIGINT beyond 2,147,483,647; decimals become NUMERIC, DOUBLE, REAL or FLOAT; true and false become BOOLEAN or BIT; YYYY-MM-DD strings become DATE; objects become JSON. Anything mixed becomes text, and the page tells you which columns.

Why are backslashes doubled in the MySQL output?

MySQL reads a backslash inside a string literal as the start of an escape such as \n, unless the server runs with NO_BACKSLASH_ESCAPES. Doubling every backslash keeps a path like C:\temp intact. PostgreSQL, SQLite and SQL Server read backslashes literally, so their output leaves them as they are.

How many rows can one INSERT statement have?

SQL Server allows 1,000 rows in one VALUES list and returns error 10738 beyond that. PostgreSQL, MySQL and SQLite have no fixed row limit, but very long statements hit packet or memory limits, so 100 to 1,000 rows per statement is a safe choice. Batches here default to 100 rows.

Can I convert a CSV file to SQL as well?

Yes. Paste CSV or TSV with a header row instead of JSON and the delimiter is detected. Empty cells become NULL, numbers and true or false get typed columns, and values with leading zeros, such as ZIP code 00501, stay text so the zeros are kept.

Is my data uploaded when I convert it?

No. Reading the JSON or CSV, working out the column types and writing the SQL all happen in your browser, and nothing is sent to a server or stored. The file you download is created on your device as well.

Sources

  • PostgreSQL 17 documentation, Lexical StructureString constants with doubled quotes, quoted identifiers and case folding
  • PostgreSQL 17 documentation, Data TypesINTEGER, BIGINT, NUMERIC, BOOLEAN, DATE, TIMESTAMP, TIMESTAMPTZ, JSONB
  • MySQL 8.4 Reference Manual, String LiteralsBackslash is an escape character unless NO_BACKSLASH_ESCAPES is set
  • SQLite, Datatypes In SQLiteType affinity: TEXT, INTEGER, REAL; dates stored as ISO-8601 text
  • SQLite, SQL KeywordsWhich names must be quoted, and the quoting styles
  • Microsoft Learn, Table Value Constructor (Transact-SQL)An INSERT ... VALUES list is limited to 1,000 rows

Last verified 17 October 2026.

Rates and rules change; check the source before you rely on a figure.

Still stuck? Ask about JSON to SQL Converter and anybody who knows can answer. No account needed.

Common uses

  • CSV to SQL ConverterTurn a CSV file into a CREATE TABLE and INSERT statements, with column types worked out
  • JSON to MySQL ConverterGenerate MySQL CREATE TABLE and INSERT statements from JSON, with backslashes escaped

Same job, other tools: TSV to JSON – Convert tab-separated values, such as a paste from Excel, into JSON · JSON to YAML – Turn JSON into clean, readable YAML for configs · Query String Parser – Split a URL query string into a table of decoded parameters.

Related tools

All developer tools
Base64 Encode & DecodeText and files to Base64 and back, with URL-safe mode and image previewUnix Timestamp ConverterUnix timestamps to dates and dates to timestamps, in any time zoneJSON to TypeScriptGenerate TypeScript interfaces or types from a JSON sampleCSV to JSONConvert CSV to JSON and JSON to CSV, with a table previewYAML to JSONConvert YAML to JSON and JSON to YAML, with anchors resolvedURL Encoder / DecoderPercent-encode or decode text and URLs, and see every part of a linkColor ConverterHEX, RGB, HSL, HWB, OKLCH and CMYK in both directions, with a contrast checkNumber Base ConverterBinary, octal, decimal, hex and any base to 36, exact at any size, with two's complement
Was this tool helpful?
Omnikit

Small jobs, done in your browser. Free, fast and private. Files are never uploaded.

Files

  • Compress Image
  • Image to PDF
  • Merge PDF
  • Compress PDF
  • PDF to Word
  • Word to PDF

Dev

  • JSON Formatter & Validator
  • Base64 Encode & Decode
  • JWT Decoder, Verifier & Encoder
  • Password Generator
  • UUID Generator
  • Unix Timestamp Converter

Money

  • SIP Calculator
  • EMI Calculator
  • GST Calculator
  • FD Calculator
  • PPF Calculator
  • Lumpsum Calculator
GuidesQuestionsAboutHow we checkLaw library (beta)PrivacyTermsDisclosureContactMore: Exam practice (UGC NET Paper 1)Runs in your browser. Nothing is uploaded. © 2026 Omnikit (theomnikit.com)