Skip to content
Json Works

Runs in your browser · nothing is uploaded

JSON to SQL Converter

Turn a JSON array into CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQLite, SQL Server or Oracle. Types are inferred for you. Nothing is uploaded.

JSON input

Empty

SQL

—

From API response to database in one paste

Seeding a table from a Postman response should not need a script. Json Works infers a schema from every row, picks sensible types for each database, escapes values properly and batches the INSERTs — then hands you SQL you can run straight away.

How the conversion works

The tool reads every object in your JSON array, collects the keys as column names, and looks at the values to choose a type for each column: integers, decimals, booleans, dates or text. It then writes a CREATE TABLE statement and a batch of INSERT statements. Choose your database first, because quoting and type names differ between PostgreSQL, MySQL, SQLite, SQL Server and Oracle.

Example

An array such as [{"id": 1, "name": "Ada", "active": true}] produces a table with an integer id, a text name and a boolean column active, followed by an insert for each row. Strings are escaped, so a name such as O'Brien will not break the statement.

Things to review before running the SQL

  • Primary keys and indexes. The generated table is a starting point; add constraints and indexes that fit your data.
  • Nested objects and arrays. These do not map to a single column. Flatten them first, or store them as a JSON column if your database supports it.
  • Column types. Types are inferred from the sample you paste, so make sure it includes representative values, including nulls.
  • Test database first. Run generated statements against a development database before production.

Read Generate SQL INSERT statements from JSON for a worked example, and see How to flatten nested JSON if your data has nested objects.

How to use JSON to SQL

  1. Paste a JSON array of objects (or a response with the array inside it).
  2. Choose the database, table name and how many rows per INSERT.
  3. Review the inferred column types in the generated CREATE TABLE.
  4. Copy the SQL or download it as a .sql file.

Private by design

JSON to SQL runs entirely in your browser. Your data is parsed and converted on your device with JavaScript — it is never sent to a server, logged or used for analytics. Recent inputs are kept in your browser’s own storage so you can come back to them, and they disappear when you clear cookies and site data (or press Clear history). You can verify this in your browser’s network tab.

Frequently asked questions

Which databases are supported?

PostgreSQL, MySQL, SQLite, SQL Server and Oracle. Each gets the right column types, identifier quoting, boolean literals and string escaping for that engine.

How are column types chosen?

Types are inferred from every row: integers (BIGINT when large), decimals, booleans, ISO dates and timestamps, UUIDs, and text. Nested objects and arrays become JSONB, JSON or text columns, or you can flatten objects into separate columns.

Is the SQL safe to run?

Strings are escaped for the chosen dialect, but you should always review generated SQL before running it against a production database. Nothing is sent anywhere — it is generated in your browser.

Can I generate several rows per INSERT?

Yes. Choose a batch size (1, 100, 500 or 1000 rows) to balance readability and import speed.

How can I convert JSON data to a SQL table?

Paste a JSON array into the tool, pick your database (PostgreSQL, MySQL, SQLite, SQL Server or Oracle) and it generates a CREATE TABLE statement with inferred column types, followed by INSERT statements for every row. Copy the SQL and run it in your database client.

How to query JSON in SQL?

Every major database has JSON functions. PostgreSQL uses the -> and ->> operators or jsonb_path_query(). MySQL uses JSON_EXTRACT() or the ->> operator. SQL Server uses JSON_VALUE() and OPENJSON(). Oracle uses JSON_VALUE() and JSON_TABLE(). SQLite uses json_extract(). To test the path before putting it in a query, try the JSONPath tester on this site.

How to insert JSON data into a PostgreSQL table?

Generate CREATE TABLE and INSERT statements with this tool for PostgreSQL and run them in psql or pgAdmin. Inside PostgreSQL itself you can also insert from a JSON array with INSERT INTO t SELECT * FROM jsonb_populate_recordset(NULL::t, '[...]'::jsonb). Nested objects and arrays are stored in jsonb columns.

How to insert JSON data into an Oracle table?

Choose Oracle as the dialect to get INSERT statements with Oracle types and quoting. Within Oracle 12c and later you can also use JSON_TABLE, for example INSERT INTO t SELECT * FROM JSON_TABLE(:json, '$[*]' COLUMNS (id NUMBER PATH '$.id', name VARCHAR2(100) PATH '$.name')).

How to insert JSON data into a database table?

Convert the JSON array to INSERT statements for your database and run them, or use the database's own JSON import (jsonb_populate_recordset in PostgreSQL, OPENJSON in SQL Server, JSON_TABLE in MySQL 8 and Oracle). For large files, choose a batch size of 500 or 1000 rows per INSERT to speed up the import. Always review generated SQL before running it on production.

Found a bug or have an idea for this tool? Send feedback.

Guides for JSON to SQL

More JSON tools

History

Saved only in this browser (IndexedDB). It never leaves your device and disappears when you clear cookies and site data.