Sign up free

JSON to SQL Converter

Paste a JSON array and get ready-to-run INSERT statements for your database, without uploading anything.

or drop files here

Accepts JSON

Runs in your browser. Your files never leave your device.

About JSON to SQL

JSON to SQL turns an API response, a fixture file or a NoSQL export into statements a relational database can run. Paste the JSON or open a file and the SQL is written as you type: each object becomes a row, each key a column, and nested objects are flattened into columns such as address.city. If the data sits in a spreadsheet or CSV instead, Excel to SQL does the same job.

Choose MySQL, PostgreSQL, SQLite, SQL Server or Oracle under Database and identifiers are quoted the right way for it. Include CREATE TABLE adds a table definition with types picked from the values: integers, decimals, booleans or text of a fitting length. Strings are escaped, null and empty values become NULL, and rows are grouped 100 per INSERT unless you change it under More options. The JSON stays in your browser the whole time.

How to use JSON to SQL

  1. 1
    Paste or open the JSON

    Paste an array of objects into Input, or open a .json file; Example loads two sample rows.

  2. 2
    Set the database options

    Pick the Database and enter a Table name. Include CREATE TABLE is on, for a table that doesn't exist yet.

  3. 3
    Copy the SQL

    The JSON to SQL output updates live. Copy it or Save it as a .sql file.

Why use Cubfile for this

  • Right quoting per database

    Backticks, double quotes or square brackets, and uppercase names for Oracle.

  • Types inferred

    BIGINT for large integers, BIT for SQL Server booleans, VARCHAR2 for Oracle text and so on.

  • Nested JSON handled

    Nested objects become dotted columns, and lists of simple values are stored as one text value.

  • Stays on your device

    No upload and no task count, so it's fine for real customer data.

FAQ

JSON to SQL: questions and answers

How does JSON to SQL build the column list?
From every key found in the objects, in the order they first appear. A record that lacks a key gets NULL in that column. To look over those columns before loading them, JSON to Excel lays the same data out as a spreadsheet.
Can JSON to SQL create the table too?
Yes. Include CREATE TABLE is on by default, so a CREATE TABLE statement comes first, with a type for each column based on its values. Untick it to get only INSERT statements.
How are booleans written?
TRUE and FALSE for MySQL and PostgreSQL, 1 and 0 for SQL Server, Oracle and SQLite, matching what each database accepts.
Is my JSON uploaded when I convert it to SQL?
No. The SQL is generated by your browser, so the data never leaves your computer.
Is there a row limit when converting JSON to SQL?
There's no fixed one. It's free and doesn't count as a task, and very large arrays are limited only by your browser's memory. Rows per INSERT can be set between 1 and 1,000.
Share JSON to SQL with a friendIt runs in any browser, and they can try it without signing up.

Related tools

XLSSQL Excel to SQLGenerate CREATE TABLE and INSERT statements from Excel or CSV.
XMLXLS XML to ExcelTurn repeating XML records into spreadsheet rows.
CSVXLS CSV to ExcelOpen CSV and TSV data in Excel with the right columns and encoding.
CSVJSON CSV to JSONConvert CSV to JSON in your browser. Nothing is uploaded.
CSVXML CSV to XMLConvert CSV or Excel rows into XML records.
XLSCSV Excel to CSVSave each sheet as CSV, line breaks in cells handled.
XLSHTML Excel to HTMLTurn a sheet into an HTML table you can paste into a page.
XLSJPG Excel to ImageSnapshot sheets and charts as images.