🗃️ JSON to SQL Converter
Convert JSON arrays/objects to SQL INSERT and CREATE TABLE statements. MySQL, PostgreSQL, SQLite, MSSQL support. Nested object flattening. 100% browser-based.
Dialects: MySQL, PostgreSQL (with RETURNING *), SQLite, MSSQL. Nested flattening with dot notation.
📋 When to Use
Ideal for migrating JSON API data to SQL databases, importing configuration data, or converting test fixtures. Generates clean SQL INSERT statements ready to run in your database — all in your browser.
⚙️ How It Works
The converter parses JSON, infers column types from the first object's values, and generates dialect-specific SQL. Nested objects can be flattened with dot notation, or stored as JSON strings. String values are single-quote escaped, NULL becomes SQL NULL, booleans become TRUE/FALSE (or 1/0 for SQLite). No server communication.
How to Use
- Paste a JSON array of objects or a single object into the input area.
- Select SQL dialect (MySQL, PostgreSQL, SQLite, or MSSQL).
- Configure options: CREATE TABLE, flatten nested objects, or wrap in transaction.
- Click Convert to SQL to generate INSERT statements.
- Copy or Download the SQL output.
Frequently Asked Questions
Can JSON to SQL handle nested objects?
Yes, enable "Flatten nested objects" to convert nested fields into dot-notation columns (e.g., `user.address.city`). Without flattening, nested objects are stored as JSON strings.
Which SQL dialects are supported?
MySQL, PostgreSQL, SQLite, and MSSQL. PostgreSQL adds RETURNING * to each INSERT. SQLite uses 1/0 for booleans instead of TRUE/FALSE.
How are data types mapped in CREATE TABLE?
Strings → TEXT, integers → INTEGER, floats → REAL, booleans → BOOLEAN, null → TEXT, nested objects/arrays → TEXT (JSON string).
How are NULL values handled?
NULL values in JSON are converted to SQL NULL (unquoted). Strings and numbers are handled normally.
Does the CREATE TABLE option work with any JSON?
Yes, column types are inferred from the first object's values. All rows in the array are assumed to have the same schema. Nested flattening applies to CREATE TABLE as well.
Can I convert large JSON files?
The tool works entirely in your browser — no server upload. Performance depends on your browser's JSON parsing capability. Very large files (100K+ rows) may take a moment.
Is my data private?
Absolutely. All conversion happens locally in your browser. Your JSON never leaves your device.