Logo JSON Parser Online

Generate SQL INSERT Statements from JSON

Paste a JSON array of objects, set the table name, and click Generate. The tool produces one INSERT INTO statement per row with properly quoted values. Useful for seeding a database from API data, migrating records, or generating test fixtures.

All JSON Tools

28 tools

Free, fast, runs in your browser. No login needed.

Made with ❤️ in India · © 2025 parsejsononline.com
INPUT
1
OUTPUT
1
✅ Ready
Characters: 0
Ctrl+Enter to run
What is this tool?

How to use

  1. Paste your JSON array of objects into the INPUT pane.
  2. Enter the target table name in the text field (default is users).
  3. Click Generate.
  4. Copy or download the output as a .sql file.

How it works

The generator takes the first row's keys as the column list and produces one INSERT INTO table (cols) VALUES (vals); statement per row. The column list is fixed to the first object's keys — if later rows have additional keys, those extra fields are silently omitted.

Value quoting rules:

  • Strings — wrapped in single quotes. Any single quote inside a string is escaped as '' (SQL standard doubling).
  • Numbers and booleans — written as unquoted literals (42, true, false).
  • null — written as unquoted NULL.
  • Objects and arrays — serialized to a JSON string and wrapped in single quotes. Useful for JSONB columns in PostgreSQL.

Auto-detection. If your input is a JSON object containing an array (e.g., {"users": [...]}), the generator finds and uses that array automatically.

Note on SQL dialects. The output uses standard SQL syntax compatible with PostgreSQL, MySQL, SQLite, and most other relational databases. Boolean literals (true/false) are standard SQL but some databases (e.g., older MySQL) prefer 1/0 — adjust if needed.

FAQ

What JSON structure does this expect?

An array of objects where each object represents a row. All objects should share the same keys. The column list is derived from the first object — keys present in later rows but absent from the first are ignored.

How are special characters in strings handled?

Strings are wrapped in single quotes and internal single quotes are doubled to '' — standard SQL escaping. Other special characters are not escaped, so be cautious with data containing backslashes in MySQL (which uses \' as an alternative escape).

What happens to nested objects or arrays?

Nested objects and arrays are serialized as a JSON string and placed in a single-quoted string value. This works well for PostgreSQL JSONB columns. For other databases, flatten the data first.

Can I change the table name?

Yes. Enter any table name in the text field before clicking Generate. The name is used verbatim in each INSERT statement.

Is my data sent anywhere?

No. Generation runs entirely in your browser.

Related tools

JSON to CSVConvert JSON arrays to CSV for spreadsheet import. Flatten JSONFlatten nested objects before generating SQL. JSON FormatterValidate and format JSON before generating SQL.