Free MySQL to JSON converter — no upload, no account

Convert MySQL to JSON
Dumps, query output
or an export query.

Paste mysqldump INSERT statements or the output of the mysql client and get a JSON array with the right types — or generate a JSON_ARRAYAGG query so MySQL exports the JSON itself. Runs entirely in your browser — your data never leaves your device.

Your data never leaves your browser
mysqldump INSERTs
mysql -B and table output
Exact types: 01234, NULL, BIGINT
Always free
MySQL to JSON Converter   100% client-side
MySQL input
  Result ready

      

Three ways to export MySQL to JSON

Pick the one that matches what you already have.

From a dump file

Open the .sql file produced by mysqldump, phpMyAdmin or Adminer and paste the INSERT statements. Column names come from the INSERT or from the CREATE TABLE block; several tables become one JSON object keyed by table name.

From the mysql client

Run mysql -B -e "SELECT * FROM users" mydb and paste the tab-separated output, or paste the boxed table printed in an interactive session. \N and NULL become null.

Let MySQL build the JSON

On MySQL 5.7.22+ and 8.0, JSON_ARRAYAGG(JSON_OBJECT(...)) returns the whole table as one JSON array. Choose "Generate a JSON export query" and paste your CREATE TABLE to get it ready to run.

Types are never changed silently

Quoted values stay strings, so '01234' keeps its leading zero. 1 and 0 stay numbers (TINYINT flags are not turned into booleans), NULL becomes null, MySQL backslash escapes such as \' and \n are decoded, and BIGINT values above 253 are written as exact numbers instead of being rounded. Semicolons and parentheses inside strings never cut a statement.

Related JSON tools

All schema, apis & sql tools

Frequently asked questions

Common questions about converting MySQL data to JSON.

How do I export a MySQL table to JSON?

Either paste a mysqldump of the table into this converter, or run SELECT JSON_ARRAYAGG(JSON_OBJECT('id', id, 'name', name)) FROM users; on MySQL 5.7.22 or later and save the result.

How do I convert a MySQL query result to JSON from the command line?

Use mysql -N -B -e "SELECT JSON_ARRAYAGG(JSON_OBJECT(...)) FROM t" db > t.json, or run the query with -B and paste the tab-separated output here.

Does it work with MariaDB?

Yes. mariadb-dump uses the same INSERT format, and MariaDB 10.5+ supports JSON_ARRAYAGG and JSON_OBJECT.

Is my database data uploaded?

No. The SQL is parsed by JavaScript in your browser and nothing is sent to a server.
Go up