Skip to content

SQL to JSON Converter

Extract data from SQL INSERT statements and convert it into JSON. Paste one or many INSERT INTO ... VALUES statements and get a clean JSON array of objects.

Category: data
Use Case: Database Export, API Fixtures, SQL Dump Review
Privacy: 100% browser-based

Conversion Options

Recommended Settings

Pro Tips

  • Works with a single INSERT statement with many VALUES tuples, or multiple separate INSERT statements for the same table
  • Escaped single quotes ('') inside string values are automatically unescaped
  • NULL becomes JSON null, and TRUE/FALSE become real JSON booleans, not strings
  • If an INSERT statement doesn't list column names, generic column1, column2... keys are generated
  • Values containing commas, quotes, or parentheses are handled correctly, even inside quoted strings

Most Popular

Most users paste a batch of INSERT statements with explicit column names and keep pretty printing enabled

When to Use This Tool

Database Export & API Fixtures

Extract data from a SQL dump or seed file's INSERT statements into JSON for use as API mock data, test fixtures, or import into a JSON-based data store.

Reviewing SQL Dumps

Quickly inspect the actual data inside a large .sql backup or seed file by converting its INSERT statements into readable, structured JSON.

Test Data & Seed Scripts

Convert INSERT statements used for database seeding into JSON fixtures for unit tests, mocks, or frontend development against sample data.

Data Migration Between Systems

Bridge SQL-based systems and JSON-based APIs or NoSQL databases by converting INSERT statement data directly into JSON documents.

How It Works

1

Split the SQL input into individual statements, respecting semicolons inside quoted strings

2

Filter to statements starting with INSERT INTO, and parse each one's table name, optional column list, and VALUES section

3

Extract each parenthesized VALUES tuple, correctly handling nested parentheses and commas inside quoted string values

4

Parse each value into its proper type: strings (with escaped quotes unescaped), numbers, booleans, or null

5

Map each row's values to the column names to build one JSON object per row, then stringify the array

100% Private

Files never leave your device. All processing happens locally in your browser.

Lightning Fast

Powered by Pure JavaScript for optimal performance on modern browsers.

Secure

No data collection, no tracking, no sign-up required.

Frequently Asked Questions

What SQL syntax does this tool support?

It parses standard INSERT INTO table (columns) VALUES (...), (...); statements, including statements without an explicit column list. It focuses on extracting data, not schema - CREATE TABLE statements and other SQL are ignored.

Can I convert multiple INSERT statements at once?

Yes. Paste any number of INSERT statements - whether they're multiple separate statements or one statement with many VALUES tuples - and all their rows are combined into a single JSON array.

What happens if column names aren't specified in the SQL?

If an INSERT statement doesn't list column names (e.g., INSERT INTO t VALUES (1, 'x')), generic keys like column1, column2 are generated based on the widest row.

How are strings, NULL, and booleans handled?

Single-quoted strings are unescaped ('' becomes a single quote), NULL becomes JSON null, and TRUE/FALSE become real JSON boolean values rather than the strings 'true'/'false'.

Can it handle values containing commas or parentheses?

Yes. The parser tracks quotes and parenthesis depth character by character, so a string value like 'Loves (parens) and, commas' is parsed as a single value and won't be mistaken for multiple columns.