LazyTools

🔒 Every tool runs in your browser — the files and values you enter are never uploaded to any server. How it works

🗃️ JSON to SQL INSERT Converter

Paste a JSON array of objects and get ready-to-run SQL INSERT statements — numbers, booleans and NULLs typed, strings safely quoted.

2 rows

Rate this tool:
Anonymous — no account, no identifier

How the json to sql insert converter works

The tool parses your JSON (an array of objects, or a single object) and builds INSERT statements. The column list is the union of the objects’ keys in first-seen order, and each value is typed and escaped: numbers and booleans become SQL literals (TRUE/FALSE), null and missing keys become NULL, and strings are wrapped in single quotes with embedded quotes doubled (O'Brien → 'O''Brien'). By default it emits one compact multi-row INSERT; tick the option for a separate statement per row.

The single-quote escaping matters: it’s the difference between a clean import and a broken statement (or an injection risk) when your data contains apostrophes. Column and table names are lightly sanitised to safe identifiers. This generates standard ANSI-style INSERTs that work in PostgreSQL, MySQL and SQLite; if your dialect needs backtick-quoted identifiers or a different boolean literal, a quick find-replace adjusts it. Everything runs locally, so the data you paste never leaves your browser.

Frequently asked questions

How do I convert JSON to SQL INSERT statements?

Paste a JSON array of objects, set the table name, and the tool outputs INSERT statements with the keys as columns and each object as a row. Copy and run them in your database.

How are values escaped?

Numbers and booleans become SQL literals, null becomes NULL, and strings are single-quoted with any embedded apostrophe doubled (written as two single quotes) — so apostrophes in your data can’t break the statement.

Can I get one statement per row?

Yes — by default it produces a single multi-row INSERT (efficient for bulk loads); tick the option to emit a separate INSERT statement for each row instead.

Which SQL databases does it work with?

It produces standard INSERT syntax that runs in PostgreSQL, MySQL and SQLite. For dialect-specific identifier quoting you may tweak the output, but the values and structure are portable.

Is my data uploaded?

No — the conversion runs entirely in your browser and works offline, so your data stays on your device.

Related developer tools

From the blog