JSON Converter
Convert between JSON, YAML, CSV and XML in any direction, with clear error messages — all in your browser.
JSON Converter - JSON to YAML, CSV and XML and Back
Paste JSON, YAML, CSV or XML, pick the format you need, and the converted version appears as you type. Every direction works: JSON to YAML for a Kubernetes manifest, YAML to JSON for an API call, JSON to CSV for a spreadsheet, CSV to JSON for an import script, and XML to JSON when an old service still speaks XML. Parsing and conversion run in your browser, so configuration files and customer exports never leave your device.
The tool is built for the real files people paste: CSV exported from Excel with semicolons and a byte-order mark, JSON with nested objects that have to fit into columns, XML full of attributes. When the input is broken it tells you where, with a line and column, instead of failing silently.
How to convert
- Choose the input format under From and the output format under To.
- Paste your data, press Open file to load one, or press Sample to see an example.
- The result appears as you type. Adjust Indent, the CSV Delimiter or the XML Root element if you need to.
- Press Copy or Download, and use the ⇄ button to send the result back the other way.
Which format is which
| Format | Good at | Typical use |
|---|---|---|
| JSON | Exact data types, nesting, universal parser support | APIs, JavaScript, NoSQL documents, configuration |
| YAML | Readable by people, comments, less punctuation | Kubernetes, Docker Compose, CI pipelines, Ansible |
| CSV | Flat tables, opens in every spreadsheet | Exports, imports, reports, data handed to non-developers |
| XML | Attributes, mixed content, schemas | SOAP services, RSS feeds, office documents, older enterprise systems |
JSON to CSV: flattening nested data
A CSV file is a flat table, while JSON can nest objects inside objects. The converter flattens each record: a nested object becomes dotted column names such as address.city, and an array gets an index, as in tags.0 and tags.1. The columns are the union of every key found, in the order they first appear, so a record missing a field simply leaves that cell empty. Values that contain the delimiter, a quote or a line break are quoted and escaped the way RFC 4180 describes, which is what Excel, Google Sheets and database import tools expect.
Going back, CSV to JSON reads the first row as column names and turns every other row into an object. Tick Nest dotted column names and address.city becomes a nested object again, so a JSON file can make a round trip through a spreadsheet.
CSV details that usually go wrong
- Delimiter: left on Automatic, the converter looks at the first line and picks comma, semicolon, tab or pipe. European Excel exports use semicolons, and the detection handles them.
- Quoted fields: commas and line breaks inside quotes stay part of the value, and a doubled quote
""becomes a single one. - Byte-order mark: the invisible character Excel puts at the start of a UTF-8 CSV is removed, so the first column name comes out clean.
- Numbers and booleans: with Detect numbers and true/false ticked,
42becomes a number andtruea boolean. Values such as007or1.50stay text, because turning them into numbers would drop the leading zero or the trailing digit.
JSON and YAML
YAML is a superset of JSON, so every JSON document converts to YAML without loss. The other direction is where surprises live: YAML turns unquoted yes, no, dates and version numbers into other types in some parsers. This converter reads YAML with the YAML 1.2 core schema, where only true, false, numbers and null are special, so a date such as 2024-01-01 stays text. When it writes YAML, it quotes any string that another parser could misread, such as 'yes', 'on' or '1.10'. Comments and anchors have no JSON equivalent: anchors and << merge keys are expanded into full copies, and comments are dropped.
JSON and XML
XML has things JSON does not, so the converter follows a common convention. An attribute becomes a key starting with @, text that sits next to child elements becomes #text, and an element that repeats becomes an array. <book id="b1"><title>Clean Code</title></book> therefore turns into {"book": {"@id": "b1", "title": "Clean Code"}}. The same rules are applied in reverse when you convert JSON to XML, and keys that are not valid XML names have their invalid characters replaced with underscores. If the JSON has more than one top-level key, set Root element to name the wrapper element.
Error messages you can act on
A converter that shows an empty box when the input is broken wastes your time. This one says what went wrong and where: invalid JSON is reported with the line and column of the first character that cannot belong there, YAML errors come with the parser's reason, and XML that is not well-formed is reported with its position. A CSV field whose opening quote is never closed is flagged too, because it would otherwise swallow the rest of the file.
Privacy
Nothing is sent anywhere. The YAML parser is loaded once when you first choose YAML, and everything else is plain JavaScript in the page. That makes the tool safe for environment files, API responses with tokens, and exports that contain personal data.
Related tools
To check or pretty-print JSON before converting it, use the JSON formatter. To compare two versions of a configuration file, use Text Compare. For a single direction, the task pages open the converter ready to go: JSON to YAML, JSON to CSV and XML to JSON. To turn the JSON into TypeScript interfaces, Go structs or Python models instead, use JSON to Types.