JSON to SQL Converter
Turn a JSON sample into a SQL CREATE TABLE statement directly in your browser — no upload, no API call, no tracking. Paste JSON (or drop a .json file) and get a table definition with inferred column types plus a full type-decision report that shows exactly how each column was inferred.
What it generates
- Scalars become columns:
INTEGER(fits 32 bits),BIGINT(larger),REAL(decimals),BOOLEAN, andTEXTfor strings. - Nested objects are flattened into columns with an underscore separator (e.g.
address.street→address_street). - Arrays (of any kind) are stored as a
TEXTcolumn holding the JSON array. - Null values become a nullable
TEXTcolumn (the type is unknown from the sample). - Keys are converted to
snake_casecolumn names; keys that are not valid identifiers are renamed and the original is shown in a comment. - Column comments (optional) annotate each decision — renamed, nullable, or array — right in the DDL.
Why the report matters
Most schema tools hand you a CREATE TABLE and stay silent about the guesses. This one doesn't. For every column it tells you the inferred type, and for every rename or array it says what happened. That is the difference between a schema you can trust and one that quietly loses data.
Using the output
Copy the statement into your migration tool or query console. The types are dialect-agnostic (INTEGER, BIGINT, REAL, BOOLEAN, TEXT) and work in SQLite, PostgreSQL, MySQL, and most others. Arrays are kept as JSON text — normalize them into child tables yourself if you need them queryable.
How inference works (and its limits)
Column types are inferred from the values in the sample you provide, so feed it a representative payload. Integers wider than 32 bits become BIGINT; decimals become REAL. A field that is never null in the sample is emitted as non-nullable.
FAQ
Is this JSON to SQL converter free?
Yes. It runs entirely in your browser, with no login, no usage limits, and no ads on this tool. Your JSON never leaves your device.
Is my JSON data safe?
Yes. All schema generation happens locally in JavaScript. Your JSON is never sent to a server, logged, or stored. You can disconnect from the internet after the page loads and it will still work.
Does it generate INSERT statements too?
No — this tool generates the CREATE TABLE schema from a JSON sample. If you want the rows as well, use the JSON to CSV converter and import the CSV into your database.
How are nested objects and arrays handled?
Nested objects are flattened into columns using an underscore separator. Arrays are stored as a TEXT column containing the JSON array — the report flags every array so you can decide whether to normalize it into a child table.
Which SQL dialect is this for?
The generated types (INTEGER, BIGINT, REAL, BOOLEAN, TEXT) are portable across SQLite, PostgreSQL, MySQL, MariaDB, and SQL Server (with minor aliasing). Adjust types after generating if your dialect needs something specific.
Can I convert SQL back to JSON?
This tool goes JSON → SQL. For the reverse direction, use the CSV to JSON converter for tabular data.