Convert

JSON, YAML, CSV & XML Converter Online

Convert data between JSON, YAML, CSV and XML in either direction.

Runs entirely in your browser — nothing you paste is uploaded or stored.

YAML output
Converted output appears here.

What is json, yaml, csv & xml converter?

JSON, YAML, CSV and XML are the formats most config files, API responses and exported spreadsheets show up in, and moving data between them by hand is tedious and error-prone — especially CSV, whose quoting rules for a value containing a comma or a line break are easy to get wrong manually. This tool converts between all four in either direction: pick a "From" and "To" format, paste or type the data, and get a correctly formatted result immediately, including proper RFC 4180 quoting for CSV and correct type handling for JSON and YAML.

When to use it

  • Turning a CSV export from a spreadsheet into JSON to paste into an API request or a test fixture.
  • Converting a YAML config file (Kubernetes, Docker Compose, GitHub Actions) to JSON to feed into a tool that only accepts JSON.
  • Converting a JSON array of records into a CSV to open in a spreadsheet.
  • Converting an XML API response or SOAP payload into JSON to work with in JavaScript.
  • Reformatting between YAML and JSON to work around a tool that only supports one of the two.

How to use this tool

  1. Paste your data, drop a file onto the input box, or click "Load example" to see a working sample.
  2. The "From" format is detected automatically from what you paste or drop; check it and correct it if you started with something ambiguous.
  3. Choose the "To" format you want to convert into.
  4. For CSV, set the delimiter and whether the first row is a header — these only appear when CSV is involved.
  5. Copy the result, download it as a file, or copy a link that restores this exact conversion.

Example

A small table converted from JSON to CSV.

Input

[{"name":"Ada","role":"Engineer"},{"name":"Grace","role":"Admiral"}]

Output

name,role
Ada,Engineer
Grace,Admiral

Converting the other direction (CSV to JSON) with "First row is a header" checked reconstructs the same array of objects.

Why YAML uses a real parser, but CSV and XML don’t

YAML’s grammar is genuinely complex — block and flow styles, anchors and aliases, multi-line scalars, implicit typing — the kind of thing where a hand-rolled parser produces subtle, silent misreadings rather than a clear failure. This tool uses the small, well-established js-yaml library (MIT licensed) for that reason. CSV’s grammar, by contrast, is simple enough (fields, a delimiter, and one quoting rule) to implement directly and test exhaustively, so it doesn’t carry that same dependency risk. XML parsing and serialising use the browser’s built-in DOMParser/XMLSerializer — no dependency needed at all, since every browser already ships a spec-compliant XML parser.

Frequently asked questions

Why does a number or a boolean in CSV come out as a string in JSON?

Because CSV has no type system at all — every cell is just text, so there is no reliable way to tell whether "05" should become the number 5 (losing a meaningful leading zero, like a US ZIP code) or the string "05". Rather than guess and silently corrupt data like ZIP codes, phone numbers or version strings ("1.0"), this tool always keeps CSV values as strings. If you need real numbers, convert them explicitly after the fact.

What happens with nested objects or arrays when converting to CSV?

CSV is inherently flat — a row of cells, nothing nested — so a nested object or array value is embedded as its JSON text inside that one cell rather than being dropped or causing an error. It round-trips as text; it just isn't broken out into further columns.

Why is my JSON array rejected when converting to CSV?

Converting to CSV needs the array's contents to be uniform — either every element is a flat object (which becomes a row, with the union of every object's keys as the header), or every element is itself an array (which becomes a row of raw cells). An array mixing objects, arrays, and plain values like strings has no single sensible row shape, so it's rejected with an explanation rather than guessed at.

Does this handle quoted CSV fields with embedded commas or line breaks?

Yes — CSV parsing follows RFC 4180's quoting rules, including a doubled `""` as an escaped quote inside a quoted field, and a quoted field that itself contains the delimiter or a newline. Malformed CSV, like an unterminated quote, is reported clearly rather than silently misreading the rest of the file.

How are XML attributes and repeated tags represented in JSON/YAML/CSV?

There's no universal standard for this, so the tool uses one explicit, documented convention. An attribute becomes an object key prefixed with `@` (`<a id="1">` becomes `{"@id": "1"}`). Element text alongside attributes or child elements goes under a `#text` key. Repeated sibling tags, like several `<item>` elements in a row, collapse into a JSON array under that tag name — a single occurrence stays a plain value rather than a one-element array. Converting the other way round applies the same rules in reverse, so a document that started as XML round-trips back to the same XML.

What happens to a JSON key that isn't a valid XML tag name (spaces, symbols, a leading digit)?

It's sanitised rather than rejected — invalid characters become `_`, and a name that doesn't start with a letter or underscore gets one prefixed, so every key produces valid XML. Because XML also requires exactly one root element, a JSON array or an object with more than one top-level key gets wrapped in a `<root>` element (a top-level array becomes repeated `<item>` children of it); an object with exactly one top-level key uses that key as the root tag instead, which is what lets a document converted from XML convert cleanly back to it.

How reliable is the automatic format detection?

It's a convenience default, not a guarantee — it looks for clear structural signals (JSON's braces, YAML's "key:" lines or "---" markers, CSV's delimiter-separated header row) and only switches the "From" format when it finds one it's confident about; otherwise it leaves your current selection alone rather than guessing. It only runs on a drop or a paste into an empty box, never on ordinary typing, and you can always override it with the "From" selector.

Is there a size limit?

Yes, five million characters — everything runs synchronously in your browser tab with no server to offload to, so an unbounded input would freeze the page with no way to show progress. That's generous enough for any config file or spreadsheet export a person would realistically paste in by hand.

Find these tools useful? A coffee helps keep them free and ad-light.

Buy me a coffee