About sql to json converter
Convert SQL INSERT statements into a JSON array of objects, handling quoted values and NULL.
Uses
- Moving seed data into an API or test fixture.
- Inspecting data from a dump.
A worked example
INSERT INTO users (id, name) VALUES (1, 'Asha'), (2, 'Ravi'); becomes [{"id":1,"name":"Asha"},{"id":2,"name":"Ravi"}]. NULL becomes null, quoted values become strings and unquoted numbers stay numbers.
Useful when
- Turning a database dump into fixtures for an app.
- Inspecting sample data in a more familiar format.
- Loading seed data into a NoSQL store.
Limits
It reads INSERT statements, not full queries. Functions such as NOW() are kept as text, and large dumps with many tables should be converted one table at a time.
Type handling
Unquoted numbers become JSON numbers, quoted values become strings and NULL becomes null. Dates stay as strings, since JSON has no date type.
