JSON to SQL CREATE TABLE
Generate SQL CREATE TABLE statements from JSON, in your browser.
What it's for
JSON to SQL schema without writing DDL
Compatible with major engines
Generates DDL compatible with PostgreSQL, MySQL, SQLite, and SQL Server. Select the dialect before copying.
100% private
Your JSON is processed in the browser. Your data structures are never sent to external servers.
Correctly inferred types
VARCHAR, INTEGER, DECIMAL, BOOLEAN, and TIMESTAMP inferred from the actual value of each JSON field.
Instant
SQL schema generated in milliseconds. No signup, no waiting, no installations.
How it works
Three steps, no hassle
Paste your JSON
Paste a JSON object or array. The parser infers the most appropriate SQL types for each field.
Generate the SQL DDL
A CREATE TABLE statement is generated with inferred column types: VARCHAR, INTEGER, DECIMAL, BOOLEAN, and TIMESTAMP.
Copy and run in your database
Copy the generated SQL and run it in PostgreSQL, MySQL, SQLite, or another compatible engine. Adjust types as needed.
FAQ
Got questions?
Types are inferred by these rules: strings become VARCHAR(255) by default; integers become INTEGER; decimal numbers become DECIMAL(10,2); boolean values (true/false) become BOOLEAN; strings with ISO 8601 date format become TIMESTAMP; and null is treated as nullable VARCHAR(255). You can adjust lengths and types after generation.
If the JSON contains a field named 'id' (or 'ID', 'Id'), it is automatically generated as PRIMARY KEY with SERIAL type (auto-increment) in PostgreSQL, or INTEGER AUTO_INCREMENT in MySQL. If there is no id field, an id column can be added automatically as the first column.
The table name is inferred from context: if the JSON is an array named 'users', the table will be called 'users'. If it's an object without a context name, 'records' is used as the default name. You can change the table name in the name field before generating.
Nested JSON objects are skipped in SQL generation, as they have no direct representation in a flat relational table. Only top-level (flat) fields are processed. For nested structures, you would need to manually create related tables and define foreign keys.
The generated SQL follows the SQL-92 standard with small dialect variations. PostgreSQL uses SERIAL for auto-increment. MySQL uses AUTO_INCREMENT. SQLite uses INTEGER PRIMARY KEY AUTOINCREMENT. The tool lets you select the target SQL dialect before generating.
Database schema design, JSON-to-relational mapping, and ORM alternatives
Database schema design is one of the most critical steps in application development. When the data contract is already defined in JSON (for example, the response from an external API), converting that JSON schema to a SQL table is a mechanical but tedious task. Correctly inferring column types, handling nullable values, and generating the right DDL syntax for each database engine consumes valuable development time.
The mapping between the JSON data model and the relational model is the foundation of ORMs (Object-Relational Mappers) like Hibernate (Java), Entity Framework (.NET), SQLAlchemy (Python), and Sequelize (Node.js). However, for one-off migration scripts, ad-hoc data analysis, or rapid prototyping, generating DDL directly from JSON is faster than configuring a full ORM.
PostgreSQL and MySQL handle JSON data natively (JSON and JSONB types), but for efficient queries with indexes and joins, the traditional relational structure remains superior. Converting JSON to SQL CREATE TABLE is common in data ingestion workflows, ETL pipelines, and when importing data from external APIs into internal databases. Convertir.ai generates this DDL directly in the browser without sending your data to any server.