JSON to SQL — Free Online Generator
JSON to SQL converter — turn a JSON array into CREATE TABLE + INSERT statements for Postgres, MySQL, or SQLite. Auto type inference, browser-based.
PDFFlare's JSON to SQL converter turns a JSON array of flat objects into CREATE TABLE + INSERT SQL statements for PostgreSQL, MySQL, or SQLite. Auto-infers column types from the values, escapes strings correctly, and emits a single multi-row INSERT for fast import.
Need a flat data export instead? JSON to CSV. Excel format? JSON to Excel (.xlsx). For nested data, flatten first with JSON Flatten.
How to Convert JSON to SQL CREATE TABLE + INSERT
Paste a JSON array of objects
Each object becomes a row. The union of keys across every object becomes the column set.
Pick a table name and dialect
PostgreSQL, MySQL, or SQLite. The dialect changes identifier quoting and primitive type names (BIGINT vs INTEGER, BOOLEAN vs INTEGER).
Click Convert to SQL
PDFFlare emits a CREATE TABLE statement followed by a single INSERT … VALUES (…), (…); for every row.
When Do You Need JSON to SQL?
Seeding a database: You have a JSON fixture for tests; you want it loaded into your dev DB. Convert to SQL once, run on every fresh checkout.
Migrating from NoSQL to relational: Export a Mongo collection or Firestore export as JSON. Convert to SQL, refine the schema, run against Postgres/MySQL/SQLite.
Quick analytics: You scraped or exported some JSON and want to query it with real SQL (joins, aggregates, window functions). Convert, load into SQLite, query.
Onboarding a SaaS account: The platform exports settings as JSON; the new tooling expects SQL fixtures. Convert in the middle to bridge formats without a custom ETL script.
Why Use PDFFlare for JSON to SQL?
Three Dialects
PostgreSQL, MySQL, SQLite — switch with one dropdown. Identifier quoting and primitive types adjust automatically.
Smart Type Inference
Per-column type detection across all rows. Mixed types fall back to TEXT so the import never fails.
100% Browser-Based
Conversion runs in your browser — JSON exports never touch a server.
No Signup Required
No account, no rate limits.
Frequently Asked Questions About JSON to SQL
PostgreSQL, MySQL, and SQLite. The differences: Postgres uses TEXT for strings, BIGINT for integers, BOOLEAN; MySQL uses VARCHAR(n) for strings and backticks for identifier quoting; SQLite uses TEXT and INTEGER (no native BOOLEAN, so booleans become INTEGER). Pick the one that matches your target database.
Per column, across every row: if every value is an integer, the column is BIGINT/INTEGER. If any decimal appears, it becomes DOUBLE PRECISION. All-boolean → BOOLEAN/INTEGER. Mixed or string values → TEXT/VARCHAR. NULL values are skipped during inference. Refine manually for precision (e.g. NUMERIC(10,2) for money).
The column set is the union of all keys seen across all rows. Rows missing a key get NULL in that column's INSERT slot. The CREATE TABLE doesn't add NOT NULL anywhere — you can add constraints manually.
No. The CREATE TABLE expects flat rows. Nested objects and arrays are JSON-stringified into a single TEXT column so you don't lose data, but if you want them as proper columns, flatten the JSON first (see PDFFlare's JSON Flatten tool).
Not automatically — the tool can't know which column is the primary key. The CREATE TABLE is the column shapes only. Add PRIMARY KEY, UNIQUE, and INDEX constraints manually after pasting.
Single quotes inside string values are escaped as '' (SQL-standard). Other special characters (backslashes, control chars) pass through verbatim — works correctly on Postgres with standard_conforming_strings on (the default since 9.1) and MySQL with NO_BACKSLASH_ESCAPES enabled.
No. Conversion runs entirely in your browser. Your JSON never uploads — safe for production exports, customer data, internal datasets.
Yes — for moderate row counts (a few thousand). For millions of rows, prefer your database's bulk-load utility (psql \COPY, mysqlimport, sqlite3 .import) with a CSV file (see PDFFlare's JSON to CSV tool). Multi-row INSERT statements work but have higher per-row overhead.