Convert JSON to SQL Table
Instantly generate SQL CREATE TABLE statements from your JSON objects. Supports MySQL, PostgreSQL, and SQLite.
JSON Input
Output SQL
Instant SQL
Generate SQL CREATE TABLE statements instantly
Privacy First
All processing happens locally in your browser
Multi-Dialect
Supports MySQL, PostgreSQL, and SQLite
Converting JSON to SQL: Schema Inference and INSERT Generation
Converting JSON data to SQL involves two steps: inferring a table schema from the JSON structure (CREATE TABLE), and generating INSERT statements for the data rows. The converter examines the keys and value types of your JSON objects to determine column names and SQL data types — strings become VARCHAR or TEXT, numbers become INT or DECIMAL, booleans become BOOLEAN or TINYINT, and nested objects or arrays are handled based on the target dialect.
Schema Inference
JSON is schemaless — different objects in an array can have different keys and value types. SQL requires a fixed schema. The converter scans all objects in the input array to build a complete set of columns, using the broadest compatible type when values are inconsistent (e.g., if one row has an integer and another has a decimal, the column becomes DECIMAL). Columns present in some objects but not others are made nullable. This produces a working schema for the majority of JSON datasets, though you may want to review and refine it for production use.
Dialect Differences
MySQL uses AUTO_INCREMENT for auto-incrementing primary keys and stores JSON columns as JSON (MySQL 5.7+) or TEXT. PostgreSQL uses SERIAL or GENERATED AS IDENTITY, and supports JSONB for indexable JSON storage. SQLite is dynamically typed — column types are suggestions, not constraints — and uses INTEGER PRIMARY KEY for auto-increment. Choose the dialect that matches your database when using the generated SQL.
How to Use This Tool
Paste a JSON array of objects and select your SQL dialect. The output includes both the CREATE TABLE statement and a batch of INSERT statements for all rows. Copy the SQL to run directly in your database client, or use it as a starting point for your own migration script.