JSON to SQL

Seed a database from JSON without writing INSERTs by hand.

How JSON to SQL works

Turn a JSON array into a CREATE TABLE statement plus INSERT rows with inferred column types. Everything happens inside this page: the tool reads your input, runs the calculation or conversion locally, and hands the result back to you. Nothing is transmitted, because there is no backend to transmit it to.

That design choice is deliberate. Most free tool sites upload your files to a server, process them there, and quietly keep a copy. Toolcin cannot do that — the site is a set of static files. If your connection dropped the moment the page finished loading, every tool would still work.

What gets generated

A CREATE TABLE statement with an inferred column type per key, followed by INSERT rows. The table is named data and the types come from the first row's values: a number becomes INTEGER or REAL, a boolean becomes BOOLEAN, everything else becomes TEXT.

Keys are collected across all rows, so an object missing a field produces a NULL rather than shifting the columns.

JSON valueColumn type
1INTEGER
1.5REAL
trueBOOLEAN
"text"TEXT
nullTEXT, nullable

Type inference is a guess

If the first row has id: 1 and the tenth has id: "A-12", the column is INTEGER and the insert fails. Inference looks at one value, not the whole dataset, so mixed types are the main reason generated SQL does not run.

Dates are the other case: an ISO string becomes TEXT, which is correct for storage but loses date arithmetic unless you cast it.

Use it as a starting point

The output is meant to be edited before it touches a real database — add the primary key, the indexes, the constraints and the correct types. Generated DDL is a scaffold, not a migration.

Values are escaped for quotes, so a name like O'Brien does not break the statement. That is not the same as protection against injection, because you are pasting into your own database.

Good to know

  • Works offline once loaded, including on flights and in locked-down networks.
  • No file size limit beyond your device's own memory.
  • Free to use, with no account and no usage counter.
  • Results are produced locally, so they are not logged or shared with anyone.

Questions

How are column types chosen?

From the first non-null value: INTEGER, REAL, BOOLEAN or TEXT.

Are quotes escaped?

Yes, single quotes are doubled.

Can I choose the table name?

Not in this version — it is always data, so rename it in the output.

Does it handle nested objects?

They are stringified into the column rather than normalised into a second table.

Keep going

More files tools