Convert JSON files and datasets to SQL INSERT statements. Supports nested JSON, PostgreSQL, MySQL, and SQLite output dialects.
Why json2sql? Moving data from JSON into a database should be one command, not a script you maintain. json2sql takes JSON files — flat or nested — and produces correct SQL INSERT statements in your dialect of choice. Nested objects are automatically flattened into relational tables. Arrays become multiple INSERT rows. Type inference handles strings, numbers, booleans, and nulls without configuration. Pipe data from stdin, specify the table name, and get clean SQL out. Zero dependencies beyond Python 3.10+ and the CLI.
pip install json2sqlOr install directly from GitHub:
pip install git+https://github.com/Coding-Dev-Tools/json2sql.git# Basic usage — converts JSON to SQL INSERT statements
json2sql convert data.json
# Specify output dialect
json2sql convert data.json --dialect postgres
json2sql convert data.json --dialect mysql
json2sql convert data.json --dialect sqlite
# Specify output file
json2sql convert data.json -o output.sql
# Specify table name
json2sql convert data.json --table users
# Handle nested JSON (auto-flattens into relational tables)
json2sql convert nested_data.json --flatten- Nested JSON support: Automatically flattens nested objects into separate relational tables
- Multi-dialect output: PostgreSQL, MySQL, SQLite INSERT syntax
- Array of objects: Handles JSON arrays as multiple INSERT rows
- Type inference: Auto-detects strings, numbers, booleans, nulls
- Pipe support: Read from stdin for pipeline usage
- Zero dependencies: Only Python 3.10+ required (typer for CLI)
# Generate SQL as part of a data pipeline
cat data.json | json2sql convert --dialect postgres --table events > events.sql
# Use in GitHub Actions to prepare test data
json2sql convert fixtures.json --dialect sqlite -o seed.sql
sqlite3 test.db < seed.sqljson2sql is one of eight tools in the Revenue Holdings suite. One license covers all CLI tools.
| Plan | Price | Best For |
|---|---|---|
| Free | $0 | Individual devs, OSS — CLI only, limited rows |
| json2sql Individual | $9/mo ($7 billed annually) | Professional devs — unlimited rows, batch processing |
| Suite (all 8 tools) | $49/mo ($39 billed annually) | Full Revenue Holdings toolkit — 40% savings |
| Team | $79/mo ($63 billed annually) | Up to 5 devs — API access, CI/CD integration, priority support |
| Enterprise | Custom | SSO, RBAC, compliance reports, dedicated support |
🔹 No lock-in: CLI works fully offline on the free tier — no telemetry, no phone-home. 🔹 Annual billing: Save 20%.
| Feature | Free | json2sql | Suite | Team | Enterprise |
|---|---|---|---|---|---|
| CLI: convert, pipe | ✓ | ✓ | ✓ | ✓ | ✓ |
| Unlimited rows per conversion | — | ✓ | ✓ | ✓ | ✓ |
| Batch processing | — | ✓ | ✓ | ✓ | ✓ |
| Schema generation | — | ✓ | ✓ | ✓ | ✓ |
| API access | — | — | — | ✓ | ✓ |
| Compliance reports | — | — | — | — | ✓ |
| RBAC | — | — | — | — | ✓ |
| SSO / SAML / OIDC | — | — | — | — | ✓ |
| Priority support | Community | 24h | 24h | 8h | Dedicated |
Part of Revenue Holdings — CLI tools built by autonomous AI.
MIT