ToolConvoyToolConvoyv2.6
DATA

SQL to JSON — Convert SQL INSERT Statements to JSON Arrays

Convert SQL INSERT statements to JSON arrays. Parses column names, handles quoted values, and infers data types — runs in your browser, no upload.

● LOCAL · ZERO-COPY PIPELINE0 network requests from tools since page load

SQL INSERT to JSON

Convert SQL INSERT statements to JSON array format. Works with column-named inserts and bare value inserts. Auto-detects NULL, numbers, and strings. Works entirely in your browser.

SQL INSERT statements are the oldest machine-readable data format still in daily production use. Every relational database since the 1970s speaks INSERT, and every database dump tool — mysqldump, pg_dump, sqlite3 .dump — emits INSERT statements as its primary output format. JSON, by contrast, is the native language of web APIs, configuration files, and every NoSQL document store. The gap between them is bridged by a parser that understands SQL value syntax — quoted strings with escape sequences, numeric literals in decimal and scientific notation, NULL, boolean constants, and hex-encoded binary — and maps each tuple to a JSON object keyed by column name.

The parser handles the three most common real-world INSERT shapes: single-row INSERT with explicit column names, multi-row batch INSERT with comma-separated value groups, and INSERTs where the column list is omitted (common in auto-generated dumps). The output is an array of objects, one per row, which is the shape that every JSON-consuming tool expects. From there the conversion pipeline is open: feed the JSON into the JSON-to-CSV tool for spreadsheet export, the JSON-to-TypeScript tool for typed API consumption, or the JSON Schema Generator to create a validation schema that matches the original table definition. The tool runs entirely in your browser, so database dumps containing sensitive data are never uploaded.

Advertisement

How to use

  1. Paste your SQL INSERT

    Paste one or more INSERT INTO statements. The parser extracts the table name, column list, and value tuples. Multi-row batch inserts with comma-separated value groups are fully supported.

  2. Review the inferred columns

    The parser auto-detects column names from the parenthesized list after the table name. If your INSERT omits the column list, columns are named col_0, col_1, etc — rename them in the output options.

  3. Export as JSON

    Copy the JSON array to your clipboard or download as a .json file. Choose between compact (single-line) or pretty-printed output with custom indent spacing.

Frequently asked

Does it handle different SQL dialects?

Yes — MySQL, PostgreSQL, SQLite, and SQL Server INSERT syntax are all supported. The parser handles backtick-quoted identifiers (MySQL), double-quoted (PostgreSQL), and square-bracket-quoted (SQL Server) column names interchangeably.

What about NULL values and strings with escape characters?

NULL maps to JSON null. Strings with escaped single quotes (`O''Brien`) are unescaped to `O'Brien`. Backslash-escaped strings in PostgreSQL-style (`E'line\nbreak'`) are converted to literal newlines in the JSON output.

Can it parse INSERTs that span multiple lines?

Yes. The parser normalises whitespace before tokenising, so an INSERT spread across twenty lines with indentation is parsed identically to the same statement on a single line.

What happens with INSERT IGNORE or ON DUPLICATE KEY?

The IGNORE and ON DUPLICATE KEY UPDATE clauses are stripped — only the INSERT portion contributes to the output. The resulting JSON represents the data that would have been inserted, ignoring the conflict-resolution modifiers.

Limitations

  • No DDL parsingCREATE TABLE, ALTER TABLE, and other schema statements are ignored. The tool parses INSERT statements only. For extracting table definitions, use a dedicated SQL parser or your database's dump tool.
  • No subquery supportINSERT ... SELECT statements cannot be converted — the tool requires explicit value lists. Run the SELECT in your database first, then convert the result set to JSON with a native function.
  • Type inference is heuristicNumbers in quotes (`'42'`) are kept as strings because the SQL source declared them as string-typed columns. The tool does not override the schema implied by the column types.

Platform notes

macOS
MySQL and PostgreSQL on macOS both export INSERT statements with `mysqldump` and `pg_dump`. The tool is useful for pulling a subset of dump rows into a JSON-based workflow without touching the database.
Linux
`pg_dump --data-only --inserts` produces INSERT statements compatible with this tool. Pipe through `grep` to filter specific tables before pasting.
Web
Runs entirely in the browser. SQL statements never leave your device — useful for working with database dumps that contain production data.
Advertisement
Advertisement