Lintify Logo
Lintify
Converters

SQL to JSON Converter

Parse a SQL SELECT or INSERT statement and turn the result set into a JSON array of objects. Useful for snapshotting data and feeding BI tools.

SQL INSERT
1
JSON
Output will appear here…

Convert SQL INSERTs back into JSON

Database dumps, fixtures, and migration scripts often use SQL INSERT statements to represent data. If you need to feed that data into a JSON-speaking API or a JavaScript application, you need to convert the INSERTs back into JSON. Lintify parses one or more INSERT statements and produces a JSON array of objects — one object per row, with the column names from the INTO clause as keys.

The parser handles PostgreSQL, MySQL, and SQLite syntax (the three dialects differ mostly in identifier quoting, which the parser handles transparently). It also handles multi-row INSERTs — a single INSERT with multiple VALUES tuples produces multiple JSON objects, one per tuple, in the same order.

How SQL types are mapped to JSON

SQL NULL becomes JSON null.TRUE/FALSE become JSON booleans. Integer literals become JSON numbers. Decimal literals become JSON numbers (which are floats in JavaScript). String literals (single-quoted, with'' as the escape for a literal single quote) become JSON strings. Column order is preserved in the resulting JSON object.

What is not supported

Lintify does not execute SQL — it only parses literal values in INSERT statements. SQL functions and expressions like NOW(),UUID(), or 1 + 1 are treated as strings, not evaluated. If you need to evaluate SQL expressions, run the query against a real database and export the result as JSON. SELECT statements are not supported for the same reason — they require running against a database to produce results.

Multi-row INSERTs

A single INSERT with multiple VALUES tuples is the most efficient way to bulk-load data into a SQL database, and it is the format most database dump tools produce. Lintify handles this case natively: each tuple in the VALUES list becomes a separate JSON object in the output array. The column names from the INTO clause are used as keys for every object, so the result is a uniform array suitable for feeding directly into a JSON API.

Frequently asked questions

Common questions about the SQL → JSON tool.

What kind of SQL can I convert?
Lintify parses a subset of SQL focused on INSERT statements with explicit VALUES lists. Each INSERT becomes one or more JSON objects, with the column names from the INTO clause as keys. SELECT statements are not supported because they require running the query against a real database.
How are SQL NULLs handled?
SQL NULL becomes JSON null. This is the natural mapping and matches what every JSON-producing database driver does. If your consumer treats null and missing keys differently, post-process the output to delete null keys.
Are SQL functions and expressions evaluated?
No. Lintify does not execute SQL — it only parses the literal values in your INSERT statements. A value like NOW() is treated as a string, not as a timestamp. If you need to evaluate SQL expressions, run the query against a real database and export the result as JSON.
Can I convert a multi-row INSERT?
Yes. A single INSERT with multiple VALUES tuples produces a JSON array with one object per tuple, in the same order. This is the standard format for bulk data exports and works directly with most data-loading tools.
Does it preserve column order?
Yes. The keys in each JSON object appear in the same order as the columns in the INSERT INTO clause. This matters when you are diffing exports or feeding a tool that displays columns in document order rather than alphabetically.

Related tools