Aller au contenu
NewKitApp

Rechercher des outils

Accédez à n’importe quel outil par son nom

JSON to SQL Converter

Convert a JSON array of objects into a CREATE TABLE and INSERT statements for PostgreSQL, MySQL, SQLite, SQL Server, or ANSI SQL.

SQL

Paste a JSON array of objects on the left.

Qu’est-ce que JSON to SQL Converter ?

JSON to SQL Converter turns a JSON array of objects into ready-to-run SQL: a CREATE TABLE with inferred column types, followed by INSERT statements carrying the data. The header/columns are the union of every object's keys (in first-seen order), so a heterogeneous array — where some objects omit a field others have — still converts cleanly, with missing keys becoming NULL rather than breaking the conversion. Column types are inferred from the values actually present (INTEGER, a floating type, BOOLEAN, or TEXT), nested objects and arrays are serialized to JSON text since SQL has no native equivalent, and output is dialect-aware across PostgreSQL, MySQL, SQLite, SQL Server, and ANSI SQL — each with correct identifier quoting and type names so the generated SQL runs without hand-editing.

Comment utiliser JSON to SQL Converter

  1. Paste a JSON array of objects into the input box on the left.
  2. Set the table name and pick a SQL dialect.
  3. Toggle Include CREATE TABLE on for a full schema, or off for INSERT statements only against an existing table.
  4. Choose how many rows go into each INSERT — one per statement, or batched (10/50/100) for faster bulk loads.
  5. Copy the generated SQL from the right and run it against your database.

Exemples

Basic array with inferred types

Entrée : [{"id":1,"name":"Ada","active":true},{"id":2,"name":"Alan","active":false}]

Sortie : CREATE TABLE "users" ( "id" INTEGER, "name" TEXT, "active" BOOLEAN ); INSERT INTO "users" ("id", "name", "active") VALUES (1, 'Ada', TRUE);

Heterogeneous objects — missing key becomes NULL

Entrée : [{"id":1,"name":"Ada"},{"id":2}]

Sortie : INSERT INTO "users" ("id", "name") VALUES (1, 'Ada'); ... (2, NULL);

Erreurs courantes

  • Leaving Include CREATE TABLE on when the target table already exists — this produces a duplicate-table error; turn it off for INSERT-only output.
  • Assuming inferred BOOLEAN/INTEGER types exactly match your real schema — review the generated CREATE TABLE before running it against production.
  • Passing a single JSON object instead of an array — only a top-level array of objects converts to rows; a bare object is rejected.
  • Forgetting that nested arrays/objects become JSON text, not a native array/JSON column — adjust the CREATE TABLE column type by hand if your database supports one.

Pourquoi utiliser cet outil

  • Handles heterogeneous objects — missing keys become NULL instead of breaking the conversion.
  • Infers INTEGER, floating-point, BOOLEAN, or TEXT per column from the actual JSON values.
  • Five dialects (PostgreSQL, MySQL, SQLite, SQL Server, ANSI SQL) with correct identifier quoting and type names for each.
  • Adjustable INSERT batching for either maximum portability (one row each) or faster bulk loads (many rows per statement).
  • Runs entirely in your browser — the JSON data never leaves your machine.

Questions fréquentes