Home/Developer Tools/JSON to YAML / XML / CSV
🔄

JSON to YAML / XML / CSV

FREE

Convert JSON to YAML, XML or CSV

Free · No sign-up required
Loading...

What the JSON converter does

JSON is the lingua franca of APIs, but the data often has to end up somewhere else: a YAML config file, an XML feed or SOAP body, or a CSV for a spreadsheet. This tool takes JSON and converts it to YAML, XML or CSV, in your browser, with the output ready to copy or save. It complements the JSON Tools page (format, validate, tree view) by handling the format-to-format step.

The same data in each format

JSON { "users": [ { "id": 1, "name": "Ana", "admin": true }, { "id": 2, "name": "Kit", "admin": false } ] } YAML users: - id: 1 name: Ana admin: true - id: 2 name: Kit admin: false XML <root><users><id>1</id><name>Ana</name><admin>true</admin></users><users><id>2</id><name>Kit</name><admin>false</admin></users></root> CSV (of the users array) id,name,admin 1,Ana,true 2,Kit,false

Conversion rules

TargetHow JSON mapsWatch for
YAMLObjects → mappings, arrays → lists, scalars as-is; strings that look like numbers, booleans or dates are quotedVery deep nesting becomes hard to read; comments cannot be generated from JSON
XMLKeys → element names, arrays → repeated elements, a root element wraps everythingKeys with spaces or starting with digits are sanitised; attributes are not produced (everything becomes an element)
CSVAn array of flat objects → one row per object, keys as headers; nested values are stringifiedOnly tabular data converts cleanly; a single object becomes one row; mixed keys produce empty cells

Getting good CSV

  • Point the converter at the array you want as rows. If the array is nested (data.results), paste that sub-array rather than the whole response.
  • Flatten nested objects first if the spreadsheet needs separate columns: address.city rather than a JSON blob in one cell.
  • Values containing commas, quotes or line breaks are quoted per RFC 4180 and open correctly in Excel, Numbers and Google Sheets.
  • Save with a .csv extension; Excel may need “Data → From Text/CSV” for UTF-8 with non-Latin characters.

When to use which format

  • YAML — configuration read by humans: CI pipelines, Kubernetes, Docker Compose, Ansible. Comments and multi-line strings make it friendlier than JSON.
  • XML — legacy and enterprise integrations, SOAP, RSS/Atom, sitemaps, document formats, systems that require schema validation.
  • CSV — spreadsheets, bulk imports, data analysis, anything tabular.
  • JSON — stays the right choice for APIs and anything a program reads.

Round trips are lossy

JSON, YAML and XML are not equivalent. JSON has no comments, XML has attributes and mixed content that JSON cannot express, YAML has anchors and several string styles. Converting JSON → XML → JSON generally works; XML → JSON → XML may lose attributes and ordering. CSV loses all structure beyond rows and columns. Keep the original file whenever the data will need to go back.

Frequently asked questions

Can I convert the other way — YAML or XML to JSON?

YAML input is accepted (it is a superset of JSON). For XML to JSON, use the XML Tools page. CSV to JSON is on the CSV Viewer page.

Why is my CSV a single row?

The JSON is an object, not an array. Wrap it in brackets, or paste the array inside it that holds the records.

Why does the XML have a <root> element?

XML requires exactly one root. If your JSON is an object with one top-level key, that key becomes the root; otherwise a root element is added.

Numbers came out as strings in YAML.

Only when quoting is needed to preserve them (e.g. '007' or '1.10'). Plain numbers are emitted unquoted.

How large a file can it handle?

Several megabytes is fine in a desktop browser. For very large exports, use a command-line tool such as jq, yq or a script.

Is my data uploaded?

No. Conversion runs in your browser.

More tools in this category

📋
JSON Tools
View tree, format, validate and minify JSON
📄
YAML Beautifier & Validator
Format YAML and find the line that breaks it
📋
XML Tools
Beautify, validate and convert XML to JSON
🗃
SQL Formatter & Minifier
Lay out SQL clause by clause, or collapse it to one line
📝
Markdown Tools
Preview Markdown, convert to HTML and generate tables
🔑
JWT Encoder & Decoder
Decode a JWT's header and payload, or sign one with HS256