loot.tools

JSON to SQL Converter

Paste a JSON array of objects and get SQL INSERT statements, plus an optional CREATE TABLE with column types inferred from your data. Pick MySQL, PostgreSQL, or SQLite, choose one row per statement or a single multi-row insert, and copy the result. String values are quoted and escaped, booleans and nulls are handled per dialect, and it all runs in your browser.

Paste a JSON array of objects to get SQL INSERT statements, plus an optional CREATE TABLE with column types guessed from your data. String values are quoted and escaped for you. Everything runs in your browser.

JSON Input
SQL Output

What this tool does

It reads a JSON array of objects and writes the SQL to load that data into a table. Every object becomes a row, the keys become columns, and the values are turned into SQL literals - strings get single-quoted and escaped, numbers stay bare, booleans become TRUE/FALSE or 1/0 depending on the dialect, and missing or null fields become NULL. Turn on CREATE TABLE and it also guesses a column type for each field by scanning every row.

Why you'd use this

You've got JSON from an API, a fixture file, or a quick export, and you need it in a database. Hand-writing INSERT statements is tedious and easy to get wrong once apostrophes and nulls show up. Paste the JSON, pick your database, and copy clean SQL you can run as seed data, a migration, or a one-off load.

Dialects and options

MySQL uses backtick-quoted identifiers and TINYINT(1)/1/0 for booleans. PostgreSQL uses double-quoted identifiers and real BOOLEAN values. SQLite keeps everything as INTEGER/REAL/TEXT. Column types come from the data: whole numbers are INTEGER, decimals are DOUBLE/REAL, true/false is boolean, and everything else is VARCHAR or TEXT. A field that's ever missing or null is left nullable. Choose one INSERT per row for readable diffs, or a single multi-row INSERT for a faster bulk load.