Skip to content

SQL to JSON converter

SQL to JSON parses INSERT text without executing it, but the current parser treats a dump as one table-shaped stream rather than a relational database.

  • Converted with Table engine · nothing stored
  • Free: 5 conversions a day · 5 MB each
  • Higher limits →

From real runs

What you get — and what changes

  • Multi-row VALUES Kept

    The parser read two tuples from one INSERT statement and produced separate JSON objects for each tuple.

  • Quoted strings Kept

    Doubled SQL apostrophes were unescaped in parsed values, so Ada''s first import became ordinary text before mapping.

  • NULL Kept

    SQL NULL tokens became JSON null, visible for joined_at in the users row and total in the final orders row.

  • Multiple tables Changed

    A dump with users and orders returned one JSON array rather than one dataset per table.

  • Column names Changed

    The last INSERT column list won in the multi-table test, so user email values appeared under user_id and joined_at under total.

  • CREATE TABLE types Lost

    CREATE TABLE definitions and declared SQL types were not used by the parser for JSON schema or column naming.

  • SQL execution Kept

    The converter did not run SQL statements; it parsed text and returned a JSON download in 10 ms for the tested dump.

Sample conversions

Two-table dump exposes parser limit

Input
429-byte SQL dump with CREATE TABLE users, INSERT users, CREATE TABLE orders, and INSERT orders statements.
Output
288-byte JSON incorrectly started {"id":1,"user_id":"ada@example.com","total":"2026-09-10T18:30:00Z"}, showing the multi-table column overwrite.

Orders rows

Input
INSERT INTO orders (id, user_id, total) VALUES (10, 1, 1250.50), (11, 2, NULL);
Output
JSON rows for orders were shaped correctly as {"id":10,"user_id":1,"total":1250.5} and {"id":11,"user_id":2,"total":null}.

A real SQL → JSON run

We converted our SQL sample (455 B) with Table engine on 2026-09-11. It took 1 ms and produced a 598 B JSON file, 1.3× larger than the input. The engine raised no warnings.

Input · sample.sql · 455 B

1 CREATE TABLE, 4 INSERT statements

CREATE TABLE
1
INSERT statements
4
Lines
5

Output · sample.json · 598 B

Array of 4 objects; keys: column_1, column_2, column_3, column_4, column_5

Records
4
Keys
column_1, column_2, column_3, column_4, column_5

First lines of the output

json
[
  {
    "column_1": "Northwind Traders",
    "column_2": "Proposal",
    "column_3": 48000,
    "column_4": "R. Ayers",
    "column_5": "2026-10-14"
  },
  {
    "column_1": "Contoso Ltd",
    "column_2": "Negotiation",
    "column_3": 120000,
    "column_4": "P. Ng",
    "column_5": "2026-09-30"
  },
  {
    "column_1": "Fabrikam",
    "column_2": "Qualified",
…

Options and when to change them

encoding
Switch to latin1 only for older SQL dumps that are not UTF-8 encoded.

Do it yourself

sqlite3 plus jq

bash
sqlite3 scratch.db < dump.sql
sqlite3 -json scratch.db "select * from orders;" > orders.json

This executes the dump, so use a disposable local database and only trusted SQL.

SQL to JSON by API or MCP

The HTTP API and the MCP server run the exact engine this page uses (Table engine); the response carries the same warnings the web converter shows. Check support first with GET /api/v1/pairs?from=sql&to=json.

curl
curl -X POST https://filetypeconverters.com/api/v1/convert \
  -H "Authorization: Bearer $FTC_API_KEY" \
  -F "file=@input.sql" -F "from=sql" -F "to=json" \
  -F 'options={"encoding":"utf-8"}' \
  --output output.json

Options this engine accepts for SQL → JSON

KeyApplies toTypeDefault
encodingReading SQLutf-8 · latin1utf-8
delimiterWriting JSONstring,
newlineWriting JSON ·
sheetNameWriting JSONstring
dialectWriting JSONpostgres · mysql · sqlitepostgres
tableNameWriting JSONstringdata
createTableWriting JSONbooleantrue
API reference

When this is the wrong conversion

  • Use /convert/sql-to-csv or a database export when each table needs a separate output file.
  • Do not use this parser for stored procedures, COPY blocks, triggers, views, vendor DDL, or arbitrary SELECT queries.

SQL to JSON questions

Does SQL to JSON execute the dump?

No. It parses INSERT INTO ... VALUES statements as text. That avoids running unknown SQL but also means database behavior is not simulated.

Can SQL to JSON handle several tables?

Not correctly in the current API path. Our two-table dump produced one array and reused the later orders column list for earlier users rows.

Are CREATE TABLE types preserved?

No. The parser did not use CREATE TABLE declarations in the verification dump. JSON types came from value parsing, not database schema declarations.