SQL to JSON Converter (Seeder)
Paste INSERT or REPLACE ... VALUES statements, or a mysqldump or pg_dump file, and get a JSON array with one object per row, keyed by the column list. pg_dump COPY ... FROM stdin data is converted too, every value as a string, because COPY lines carry no types. Every other statement is skipped and counted in the notes, and function, procedure, trigger and package bodies are skipped, not read as rows. Strings are decoded the way MySQL reads them, or the way PostgreSQL does once the dump sets standard_conforming_strings. Nothing is uploaded; the conversion happens on this page.
How to Convert INSERT Statements to JSON
- Paste SQL into SQL Input: INSERT statements or a whole dump. The box starts with a sample, and JSON Output updates as you type. Convert to JSON runs it again.
- Choose options: Include table name adds a
_tablekey (__tablewhen a column already has that name), Pretty JSON sets the indentation, and Parse numbers and booleans turns1andTRUEinto JSON values. MySQL backslash escapes reads\'as a quote and#as a comment; turn it off for standard SQL or SQL Server, where#tmpis a table name. - Read the notes under Convert to JSON: the row count, any pg_dump setting applied, the statements and client commands skipped, and one warning per statement and kind of value kept as text, such as
NOW()or an integer too large for JavaScript. The first 20 warnings are listed, then a count of the rest. - Copy JSON or Download .json to save the result as
seed-data.json.
What the parser reads and what it refuses
Quotes first, then syntax. The text is read in one pass, so 'x--y' stays a string and only real comments are dropped (--, /* */ and, in MySQL mode, #). A quote is escaped by doubling it. With MySQL backslash escapes on, \' and \n work too, as mysqldump writes them. After SET standard_conforming_strings = on, which pg_dump writes, a backslash in '...' is an ordinary character. E'...' strings take PostgreSQL escapes such as \x41 and \u00e9. N'...', _utf8mb4'x' and $$...$$ strings are understood; hex literals stay text.
Statements split the way the clients split them. A DELIMITER ;; line changes the terminator (mysql), a GO or / line ends a batch (SQL Server, Oracle), and a SQL Server statement without ; ends where the next one starts, except MERGE, which needs its ;. A routine body (BEGIN to END, or AS to the batch end) and an IF, ELSE or WHILE block are each one skipped statement, noted (routines) or warned about (IF, ELSE, WHILE) when they hold an INSERT, because they run only when called or when their condition holds. Upsert clauses act only when a key already exists, so their rows are kept. INSERT ... SELECT and RETURNING are reported, not guessed.
Numbers JSON cannot hold. JavaScript numbers are exact only up to 9007199254740991, so a BIGINT id such as 12345678901234567890 stays a string with a warning instead of being rounded. Decimals with more than 15 significant digits, and numbers too large or too close to zero for a double (1e400, 1e-400), stay strings for the same reason. Function calls such as NOW() are copied as text and flagged, so a seed file never silently holds a value the database would have computed. A _binary value keeps its text, flagged, because JSON has no bytes.