SQL INSERT to JSON Converter
Turn INSERT statements into JSON rows. Multi-row VALUES, escapes, NULLs and hex literals handled in your browser.
Paste a dump section and get usable JSON instead of fighting regexes that split on commas inside strings. A quote- and comment-aware tokenizer understands MySQL backslash escapes, backticks and # comments as well as ANSI doubled quotes and quoted identifiers. Multi-row VALUES lists become row arrays; NULL, TRUE/FALSE, hex and exponent literals map to JSON values, and numbers outside the safe-integer range are kept as strings with a notice. Choose array-of-objects, arrays, or NDJSON, optionally wrapped with table metadata, then copy or download the result. Bad rows produce isolated errors while the rest of the dump still converts.
SQL dump
JSON output
No JSON yet
Paste INSERT statements or load an example.
3 example prompts available.
Examples
Two rows
INSERT INTO users (id, name) VALUES (1, 'Ada'), (2, 'Grace');[{"id":1,"name":"Ada"},{"id":2,"name":"Grace"}]One statement, two tuples, default objects mode.
MySQL escape
INSERT INTO t (a) VALUES ('O\'Brien');[{"a":"O'Brien"}]Backslash escapes are decoded only in MySQL mode.
ANSI escape and NULL
INSERT INTO t (a, b) VALUES ('O''Brien', NULL);[{"a":"O'Brien","b":null}]Doubled quotes encode one apostrophe; the NULL keyword becomes JSON null.
Hex and exponent
INSERT INTO t (a, b) VALUES (0x1A2B, 1.5e3);[{"a":6699,"b":1500}]Hex is read as an integer; exponent notation becomes a number.
About this tool
SQL INSERT to JSON Converter extracts rows from INSERT statements and turns them into JSON. A tolerant tokenizer reads strings, quoted identifiers, comments and numeric literals before a small VALUES grammar builds the rows — so apostrophes, escaped quotes and semicolons inside strings never corrupt the output.
MySQL mode handles backslash escapes, backticks and # comments; ANSI/Postgres mode handles doubled quotes and double-quoted identifiers. Nulls, booleans, hex and exponent literals map to JSON, and integers outside the safe-integer range are preserved as strings with a notice. Choose objects, arrays or NDJSON output, with an optional per-table wrapper.
The converter is extraction-only: it never executes SQL, never uploads your dump, and skips non-INSERT statements with a count. A bad row errors on its own while the rest of the dump still converts.
What this tool does not do
- Only INSERT (and REPLACE) statements with a VALUES clause are parsed; INSERT ... SELECT, SET clauses and COPY dumps are not supported.
- The tool reads SQL text and never executes it, so database-side functions and expressions become unsupported-token errors.
- Hex literals are interpreted as numbers; binary data fidelity is not preserved.
- Numeric literals that may lose precision are kept as strings with a notice; review them before using the output as numbers.
- Input above 50 MB is rejected because parsing is entirely client-side; dumps are never uploaded.
How to use this tool
Paste a dump section
Paste INSERT statements or load a sample. The JSON output updates live; nothing is uploaded.
Pick the dialect
Auto-detect inspects backticks, backslashes and # comments; override it if the notices show a wrong guess.
Choose an output shape
Objects key rows by column name, arrays keep positional values, and NDJSON emits one JSON object per line.
Review notices and export
Check skipped statements and isolated row errors, then copy or download the JSON.
Use cases
Seed fixtures
Turn a mysqldump table section into JSON seed data for an app or test suite.
API payloads
Convert INSERT exports into request bodies without manually transcribing rows.
Partial dump analysis
Extract a few tables from a dump into a spreadsheet-friendly JSON shape.
Output modes
| Mode | Shape |
|---|---|
| Objects | Array of { column: value } rows (default) |
| Arrays | Array of positional value arrays; used when no column list exists |
| NDJSON | One JSON object per line, with a table field for multi-table input |
| Wrapper | { table, columns, rows } metadata around a table's rows |
| Multi-table | { tableName: rows } grouping for objects and arrays modes |
Mode switches re-serialize cached rows without re-parsing the SQL.
Common mistakes
Mistake:Splitting VALUES on commas with a regex.
Fix:Commas inside quoted strings and comments break naive splits; use a quote-aware tokenizer.
Mistake:Using the wrong dialect for escapes.
Fix:MySQL decodes backslashes; ANSI expects doubled quotes. Check the auto-detected dialect before copying.
Mistake:Assuming large integers stay exact.
Fix:Values beyond Number.MAX_SAFE_INTEGER are emitted as strings with a notice to prevent silent corruption.
Mistake:Expecting full SQL validation.
Fix:Only INSERT/REPLACE ... VALUES is parsed; other statements are counted and skipped.
Mistake:Pasting binary or BLOB columns and expecting byte fidelity.
Fix:Hex literals become numbers (or strings when unsafe), so binary data is not preserved verbatim.
Frequently asked questions
Which dialects' escapes are supported?
MySQL mode decodes backslash escapes such as \' and \n, accepts backtick identifiers and # comments, and recognizes charset introducers like _binary'...'. ANSI/Postgres mode expects doubled quotes for apostrophes and treats double-quoted names as identifiers. E'...' strings decode backslashes in ANSI mode. Auto-detect guesses from backticks, backslashes and # comments; you can override it.
How are NULL and booleans mapped?
The NULL keyword becomes JSON null, TRUE becomes true and FALSE becomes false. The quoted string 'NULL' stays the string "NULL" — the tokenizer distinguishes keywords from string literals.
What happens to non-INSERT statements?
They are skipped and counted in the stats strip. Only INSERT (and REPLACE) statements with a VALUES clause are converted; you will see the skipped count next to rows and errors.
Are huge numbers kept exact?
Integers beyond the safe-integer range, and decimal literals with more than 15 significant digits, are emitted as strings with a notice. That prevents JavaScript from silently rounding them; review those values before treating them as numbers.
Is my dump uploaded?
No. Tokenizing, parsing and serialization run in your browser. The SQL is never transmitted, stored or executed — the tool only reads text.
Why did one row fail while the rest converted?
Row errors are isolated: a mismatched column count or an unsupported expression (for example NOW()) produces an error with the statement and row number, while valid rows in the same statement still appear in the output.
References & standards
Related tools
Base32 Encoder / Decoder
Encode and decode Base32 (RFC 4648) with hex input mode and Crockford variant. Handles TOTP secrets. Runs in-browser.
Base58 Encoder / Decoder
Convert hex or text to Base58 and back, with Base58Check validation (version byte + checksum). IPFS CIDs too. In-browser.
Base64 Toolbox
Professional Base64 workspace for text, files and images with Base64URL, MIME, Data URI, strict validation, image preview and ready-to-use snippets.
BibTeX to JSON Converter
Parse .bib bibliographies into structured JSON with authors, months, macros and LaTeX cleanup, all in-browser.
C# to VB.NET Converter
Convert a subset of C# — classes, methods, variables, loops — into VB.NET
CSV Data Viewer
Paste CSV and inspect it as a sortable, searchable table with delimiter detection and inline export.