Turn a JSON array into INSERT / REPLACE statements with a custom table name.

Switch tool
JSON (object or array)0 chars · 0 lines
SQL output0 chars · 0 lines

How to use

Purpose

JSON-to-SQL INSERT generator. Converts JSON objects or arrays to INSERT INTO ... VALUES statements. Supports MySQL / PostgreSQL / SQLite / SQL Server / Oracle dialects, handling string quoting, date format, null, boolean, and special-character escaping. Also supports UPSERT (INSERT ON CONFLICT / ON DUPLICATE KEY UPDATE), batch INSERT (VALUES (...), (...), (...)) vs separate INSERTs, column name mapping (snake_case auto-conversion). All conversion runs locally.

Steps

  1. Paste JSON object or array on the left
  2. Pick dialect: MySQL / PostgreSQL / SQLite / Oracle / SQL Server
  3. Specify the table name
  4. Optional: field mapping rule (JSON userName ↔ SQL user_name)
  5. Pick mode: separate INSERTs, batch INSERT, or UPSERT
  6. Right pane shows SQL statements
  7. Date formatting: 2026-01-01T08:00:00.000Z → SQL standard 「2026-01-01 08:00:00」
  8. Export .sql / one-click copy

FAQ

Why are there more quotes in the generated INSERT than I expected?
SQL strings need single quotes. A string containing a single quote (O'Brien) must escape it as two single quotes ('O''Brien'). Strings with backslashes: MySQL default requires \\\\; PostgreSQL default does not. Tool handles per dialect.
Date field format wrong?
JSON standard date is ISO 8601: 「2026-01-01T08:00:00.000Z」. SQL standard: 「2026-01-01 08:00:00」 (T → space, drop timezone and ms). Tool auto-converts. Special: PostgreSQL recommends keeping ISO 8601 with timezone (TIMESTAMP WITH TIME ZONE); MySQL uses DATETIME without timezone.
Max rows per batch INSERT?
MySQL: a single INSERT is bounded by max_allowed_packet (default 64MB), so thousands to tens of thousands of rows are fine. PostgreSQL similar. Oracle does not support INSERT INTO ... VALUES (...), (...) multi-value syntax — use INSERT ALL or SELECT FROM dual UNION ALL. Recommended: 1000-5000 rows per INSERT (more → long transactions, fewer → inefficient). Tool splits per your chosen batch size.
How to generate UPSERT?
MySQL: INSERT INTO ... ON DUPLICATE KEY UPDATE name = VALUES(name), email = VALUES(email). PostgreSQL: INSERT INTO ... ON CONFLICT(id) DO UPDATE SET name = EXCLUDED.name. Key: specify conflict columns (PostgreSQL) or have UNIQUE/PRIMARY KEY (MySQL). Tool asks for the conflict column and emits the appropriate dialect.
How to load nested JSON objects into tables?
SQL is flat — nested objects cannot INSERT directly. Approaches: 1) flatten (user.address.city → user_address_city column); 2) JSON column (MySQL JSON / PostgreSQL JSONB stores entire nested object as one column); 3) split tables (foreign key, multiple INSERTs). Tool defaults to flatten (dot → underscore); JSON column mode is an option.

Use cases

  • API data into DB: third-party JSON → INSERT for storage
  • Data migration: legacy DB JSON export → INSERT → new DB
  • Test data prep: mock-data JSON → INSERTs to populate DB
  • Seed data: project initial data (roles, permissions, menus) from JSON → SQL
  • NoSQL to SQL: migrating MongoDB / Elasticsearch data to relational DB

Use cases

API data ingest, DB migration, test data loading, seed data init, NoSQL to SQL. Backend, data engineering, DBA. Multi-dialect, UPSERT mode, batch sizing, nested object handling are the differentiators.