1
Input JSON
Paste object or array of objects
2
MySQL SQL Code
Online JSON to MySQL CREATE TABLE Statement Generator
This tool automatically analyzes JSON data structures to generate the corresponding MySQL CREATE TABLE statements, intelligently inferring types like INT, DECIMAL, VARCHAR, DATETIME, and TINYINT based on field values. If a JSON array is input, it also generates corresponding INSERT INTO batch insert statements. All generation is done locally in your browser, and no data is uploaded to servers.
Features
- Intelligent field type inference (
INT,DECIMAL,VARCHAR,DATETIME, etc.) - Auto-detects
id/uuidfields and sets them as PRIMARY KEY - Auto-generates batch
INSERT INTOstatements for JSON array inputs (up to 100 rows limit) - Customizable table name, generates
InnoDBtables withutf8mb4charset - Nested objects/arrays auto-mapped to
TEXTtype (storing JSON strings)
Type Mapping Overview
- Integer →
INT - Decimal →
DECIMAL(19, 4) - Boolean →
TINYINT(1) - Date String →
DATETIME - Short String →
VARCHAR(255)/ Long Content →TEXT - Object/Array →
TEXT(Stored as JSON string)
Applicable Scenarios
- API Data Ingestion: Quickly convert API JSON responses to database table structures
- Prototyping: Quickly create MySQL tables based on JSON data models
- Data Migration: Batch import historical JSON-formatted data into MySQL
- Database Design: Derive table structures from JSON Schema as a reference
Frequently Asked Questions
The tool infers types based on actual JSON field values: integers to INT, decimals to DECIMAL(19,4), booleans to TINYINT(1), date-like strings to DATETIME, short strings to VARCHAR(255), long content to TEXT, and objects/arrays to TEXT (storing JSON strings).
Yes. For a single JSON object, it generates a CREATE TABLE statement and one INSERT example. For a JSON array, it infers the structure from the first element and generates batch INSERT INTO statements for all elements (up to 100 limit).
Nested JSON objects or array fields are mapped to
TEXT type and stored as JSON strings in the INSERT statements. If you need to flatten nested structures, you can manually edit the generated SQL or preprocess the JSON data.Completely safe. All JSON parsing and SQL generation happen locally in your browser. Data is never uploaded to any server, making it safe for business and test data. It also works fully offline.