T
DataToolings

SQL to JSON Converter

Convert SQL INSERT statements or pipe-delimited query results to JSON arrays. Auto-coerces types and handles multi-row inserts.

What Is SQL to JSON?

SQL to JSON converts structured SQL data into JSON arrays. It supports two common formats: INSERT statements (copy-pasted from a SQL dump or migration file) and pipe-delimited tables (output from psql, MySQL CLI, or similar tools). The result is a clean JSON array you can use in APIs, test fixtures, or configuration files.

How to Use

  1. Paste SQL INSERT statements or a pipe-delimited table into the left textarea.
  2. JSON output is generated automatically.
  3. Toggle between pretty-printed and minified output.
  4. Click Copy to copy the JSON.

Features

  • Parses INSERT INTO statements including multi-row inserts.
  • Parses pipe-delimited tables (psql, MySQL CLI, or manual tables).
  • Auto-coerces types: numbers, booleans, NULL become native JSON types.
  • Handles single-quoted strings with escaped quotes.
  • Pretty-print or minified output toggle.

FAQ

What SQL dialects are supported?

The INSERT parser handles standard SQL syntax compatible with MySQL, PostgreSQL, SQLite, and SQL Server INSERT statements. Dialect-specific functions or expressions inside values are left as strings.

How does type coercion work?

Numeric values become JSON numbers, true/false become booleans, NULL becomes null, and quoted strings are unquoted. Everything else remains a string.

Can it handle multiple INSERT statements?

Yes — you can paste multiple INSERT statements for the same or different tables. All rows are collected into a single JSON array.