Convert SQL to JSON
Turn SQL files into JSON files. The tables the script creates are loaded first, with a dump from MySQL, MariaDB or PostgreSQL rewritten into SQLite's dialect.
Converted in an isolated sandbox on our serversDeleted after 24 hours
Drop SQL files on the dialor turn it to pick what to do
One JSON file for each table in your SQL script.Each table becomes an array with one object per row.
What you get
The tables the script creates are loaded first. Then each table is written out as its own JSON file, named after the table. The file is an array with one object per row.
Numbers and nulls are typed as numbers and nulls in the JSON. Binary values are written as escaped text.
Dumps from other databases
A dump from MySQL, MariaDB or PostgreSQL is rewritten into SQLite's dialect before it is loaded. The JSON then comes from the tables as they were loaded.
What changes or is left out
Dates that are not real dates, such as MySQL's 0000-00-00, are left empty. PostgreSQL true and false become 1 and 0.
Views, functions and triggers are left out with a warning. Only the tables and their rows reach the JSON files.
To go the other way, use JSON to SQL.
SQL and JSON.What each format is.
The formats
SQL Script
SQL statements as text. A database dump that any SQL tool can read or replay.
- Extensions
- .sql
- MIME type
- application
/sql - Kind
- Text and data
JSON
JSON, the data format of every API.
- Extensions
- .json
- MIME type
- application
/json - Kind
- Text and data
In your code.The same SQL to JSON conversion through the API, for your app or your agent.
$ cv convert report.sql report/ --to json$ cv convert report.sql report/ --to jsonQuestions.What people ask about SQL to JSON.
One file per table, named after the table. A script that creates several tables gives you several files.
Each row is one object in the table's array. Numbers and nulls keep their types, and binary values are escaped text.
It is not a real date, so it is left empty in the JSON.
No. Views, functions and triggers are left out, and a warning tells you so.