Free APIs For You
Free APIs For You
Free · Browser-only · No sign-up

JSON to SQL Table Generator

Paste any JSON object or array and instantly get a CREATE TABLE SQL statement with inferred column types. Supports PostgreSQL, MySQL 8, and SQLite. Detects integers, floats, booleans, dates, timestamps, and nested JSON automatically.

PostgreSQLMySQLSQLiteAuto type inferenceTimestamps100% offline
table name
json input
sql output · PostgreSQL

Type mapping

stringVARCHAR(255)
long stringTEXT
integerINT / SERIAL
floatDECIMAL(10,2)
booleanBOOLEAN
date stringDATE
timestamp stringTIMESTAMP
object / arrayJSON / TEXT
nullVARCHAR(255)

Features

Auto type inference

String, integer, float, boolean, date, timestamp — all detected automatically

Three dialects

Correct syntax for PostgreSQL, MySQL 8, and SQLite out of the box

Primary key detection

Fields named "id" become SERIAL / AUTO_INCREMENT primary keys

Timestamp columns

Optional created_at / updated_at with dialect-correct defaults

Array support

Paste an array of objects — the tool uses the first item as the schema

Browser-only

No server — your JSON and SQL stay on your device

How to use

  1. 1

    Paste JSON

    Copy a JSON object or array of objects into the input panel.

  2. 2

    Configure

    Enter a table name, select your SQL dialect, and toggle timestamp columns.

  3. 3

    Generate

    Click Generate SQL to produce the CREATE TABLE statement.

  4. 4

    Review & run

    Copy the SQL, review types and constraints, then run it in your database.

Frequently asked questions

Can I use the output directly in production migrations?

The generated SQL is a starting point. Review types (especially VARCHAR lengths), add foreign keys, indexes, and constraints appropriate to your data model before running it in production.

What if my JSON has inconsistent fields across array items?

The tool uses the first item in the array. If some objects have fields that others lack, those missing fields will not appear. Check the generated schema against your full dataset.

Does it support composite primary keys?

No. Auto-generated schemas use a single auto-increment id primary key. Composite keys must be added manually after generation.

How do I handle enum values?

String columns are generated as VARCHAR(255). If you know a field should be an enum (e.g., status with values active/inactive), manually change the column type to ENUM('active', 'inactive') in PostgreSQL/MySQL.