Skip to content
LeedyBox
Support

JSON / CSV / YAML / SQL / XML Converter

Convert and validate data locally in your browser for common development tasks.

Convert to:

SQL input supports INSERT INTO ... VALUES statements (MySQL, PostgreSQL, SQL Server and SQLite styles); paste SELECT results as CSV. CSV values are read as text. XML attributes are kept under "@attributes" and element text next to attributes or child elements under "#text". Everything runs locally in your browser.

Check the results before you use them. The tool is provided as is, without warranty, and its results can be incomplete or wrong. Terms of Service

Formats do not map 1:1. Data types, nested values, special characters and very large numbers can change during conversion. Generated SQL is not checked against your database, so test it on a copy before you run it on real data.

How to use

  1. Paste your data into the "Input source" box. Leave the "Input" menu on "Auto detect", or choose JSON, YAML, CSV, SQL or XML if you know the format.
  2. Click a format next to "Convert to". The result appears in "Output", and a message above the boxes confirms the conversion and lists anything you should check, such as large numbers that may have lost precision, renamed keys or ignored SQL statements. If the input cannot be read, the message shows the error and "Output" is cleared.
  3. Adjust the options shown for that format, such as "Delimiter" and "Nested data" for CSV, "SQL database", "Statement" and "Table" for SQL, or "Root" and "Item" for XML. Each change converts the current input again, so you do not need to click the format button again.
  4. To check the input without converting it, click "Validate syntax". It reports either that the syntax is valid or what went wrong, with the line and column when the parser provides them.
  5. Review the "Output", then click "Copy result". "Clear" empties both boxes.

Frequently asked questions

Is the data I paste sent anywhere?

No. The data is parsed and converted in your browser with JavaScript, and the tool does not upload it to LeedyBox or save it. When the page opens, it loads two open-source libraries from leedybox.com itself, js-yaml for YAML and PapaParse for CSV; they run inside the page, and your data is not sent anywhere.

How does "Auto detect" choose the format, and when should I pick it myself?

Input that starts with { or [ is read as JSON, input that starts with < as XML, and input that starts with an SQL keyword such as INSERT, CREATE, SET, START, UPDATE or WITH followed by a space, or with a -- or /* comment, as SQL. Anything else is tried as CSV when its first line contains a comma, tab or semicolon, and then as YAML. Choose the format in the "Input" menu yourself when CSV or YAML starts with a word that is also an SQL keyword, for example a CSV header row that begins with Start date or Update time, because it is then read as SQL and fails; when every line of YAML input has the same number of commas, such as title: Hello, world followed by tags: news, tech, because it can then be read as CSV; for pipe-delimited or single-column CSV, which auto detection does not recognise; and when YAML or CSV input fails, because auto detection then only reports that the format was not recognised, while a chosen format shows the parser's own error and, in most cases, where it occurred.

Does it accept JSON with comments, trailing commas or one object per line?

With the "Input" menu set to JSON, only valid JSON is accepted, so use that setting with "Validate syntax" to check that the text is valid JSON. With "Auto detect", input that starts with { or [ but is not valid JSON is read as YAML flow syntax when possible, and a note says so: trailing commas, single quotes and unquoted keys then work, but an unquoted key needs a space after its colon, because {a:1} is read as a key named a:1 with a null value. // and /* */ comments are not comments in YAML; they can end up inside keys or values, or stop the input from being read, so remove them first. JSON Lines (NDJSON) is offered as an output format but is not read as input when it has more than one line; put the lines between [ and ] with a comma after each line except the last.

Why did 1.10 become 1.1, or 01234 become 1234, when converting from YAML?

Unquoted YAML values that look like numbers are read as numbers, so a version such as 1.10 becomes 1.1, a postcode such as 01234 becomes 1234, and 0x1F becomes 31; put such values in quotes in the YAML to keep them as text. The converter reads YAML with the js-yaml core schema, which follows YAML 1.2 for booleans and dates, so yes, no, on, off and dates such as 2026-10-02 stay text, and only forms of true and false, such as True or FALSE, become booleans. When JSON is converted to YAML, strings that could be misread, such as "01234", "1.10" or "yes", are written in quotes.

Why is an XML element an object in one file and an array in another?

Child elements that repeat under the same parent become an array, but a single one becomes a plain value or object, so <items> with one <item> gives a different structure from <items> with two. Every XML value is read as text, so <id>1</id> becomes "1" and 007 keeps its zeros, while comments and processing instructions are dropped. For CSV and SQL output, rows are taken from an array inside single-key wrappers such as <items>, so with only one <item> the whole element ends up as JSON text in a single column; for CSV, "Flatten (a.b.c columns)" splits it into columns.

Can I paste a MySQL or PostgreSQL dump as SQL input?

Yes, as long as the rows are in INSERT INTO ... VALUES statements. CREATE TABLE, SET, LOCK and similar setup statements are skipped, other statements such as DROP TABLE are ignored with a note, and rows from several tables are merged into one list, so paste one table at a time if their columns differ. mysqldump leaves out column names by default, so the columns are named column1, column2 and so on unless you dump with --complete-insert. pg_dump writes rows as COPY blocks by default, which the tool does not read, so dump with --column-inserts instead. If the dump also contains functions or stored procedures, paste only the INSERT statements: the tool splits the input at semicolons, so an INSERT inside a function body can be read as data or stop the conversion.

Why do numbers from a CSV file come out in quotes, and which column types does "CREATE TABLE + INSERT" use?

Every CSV value is treated as text, which keeps leading zeros such as 01234 but turns 42 into "42" in JSON and '42' in SQL, and an empty cell becomes an empty string rather than null or NULL. Each column type is chosen from the values in that column, so a table made from CSV gets text columns: VARCHAR(255), or TEXT when a value is longer than 255 characters (NVARCHAR(255) or NVARCHAR(MAX) for SQL Server, TEXT for SQLite). When the input is JSON or YAML and every value in a column is an unquoted number, or every value is true or false, the column gets a number or boolean type instead: an integer type (INT, INTEGER or BIGINT, depending on the database and the size of the numbers), a floating-point type for decimals, or BOOLEAN (BIT for SQL Server, INTEGER for SQLite). The statement has no primary key, indexes or NOT NULL constraints, so add them before you run it if your table needs them.