JSON to SQL Insert
Turn JSON records into escaped SQL INSERT statements for a named table.
Create INSERT statements from JSON records
JSON fixtures and API exports often need to become seed rows for a relational database. This converter accepts one object or an array of objects, gathers the union of all encountered columns, and writes one SQL INSERT statement per record. Table and column identifiers are double-quoted, text uses standard doubled apostrophes, booleans become TRUE or FALSE, and missing or null values become NULL.
The default record produces an INSERT into users with id, name, active, and note columns. The name O apostrophe Reilly is emitted with a doubled apostrophe, active becomes TRUE, and note becomes NULL. Nested objects or arrays are preserved as JSON text rather than flattened into guessed relational columns.
Escaping and database-specific review
The output follows broadly portable SQL literal conventions, but database engines differ on identifier case, JSON column casts, generated columns, and multi-row insert syntax. Non-finite numbers are rejected because SQL literals cannot represent them consistently. Conversion runs entirely in your browser. Review column order, types, constraints, and transaction handling before running statements against any database.
Frequently Asked Questions
How are apostrophes in SQL text escaped?
Each apostrophe is doubled inside the single-quoted SQL literal, following standard SQL escaping.
What happens when JSON records have different keys?
The converter builds a union of columns and writes NULL for a key missing from a particular record.
How are nested objects inserted?
Nested objects and arrays are serialized as JSON text; add engine-specific JSON casts if your target database requires them.
Browse the full set of free, private, in-browser tools.