Boneyard Tools

JSON to SQL INSERT Generator

Paste JSON to generate SQL INSERT statements. Works with an array of objects or a single object, uses the union of keys as columns, and escapes strings safely so the output is ready to run.

How to convert JSON to SQL

  1. Paste or type your JSON. An array of objects works best.
  2. Set the table name the rows should be inserted into.
  3. Copy the INSERT statements or download them as a .sql file.

Examples

Array of objects

[{"name":"Ada","age":36},{"name":"Linus","age":54}]
INSERT INTO users (name, age) VALUES ('Ada', 36);
INSERT INTO users (name, age) VALUES ('Linus', 54);

Frequently asked questions

Is my data uploaded anywhere?

No. The conversion runs entirely in your browser, so your JSON and the generated SQL never leave your device.

What JSON shape works best?

An array of flat objects. Each object becomes one INSERT statement and each key becomes a column. A single object is also accepted and produces one INSERT.

How are strings and special characters handled?

Strings are wrapped in single quotes and any single quote inside the value is doubled, so a name like O'Brien becomes 'O''Brien'. That keeps the statement valid and avoids broken SQL.

How are null, booleans, numbers and nested values written?

null becomes a bare NULL, true and false become TRUE and FALSE, and numbers are written without quotes. Nested objects and arrays are serialized to JSON text and stored as a quoted string so no data is lost.

What if my objects have different keys?

The converter uses the union of all keys as the column list. Any row missing one of those keys gets NULL for that column, so every INSERT lines up.

Are table and column names made safe?

Yes. Table and column identifiers are sanitized to letters, digits and underscores, and a leading digit is prefixed with an underscore. This is a generator for trusted data, so always review the output before running it against a database.

Related tools