YAML JSON XML Converter
Convert YAML, JSON and XML in any direction, with line-numbered error messages
Runs entirely in your browser. Nothing you type or upload is sent to us or stored.
Results are for general guidance. Please check anything important before relying on it. Terms of use
How to Use
- Choose what you have under From (YAML, JSON or XML) and what you need under To. The button swaps the direction.
- Paste your data into the input box, or tap Open a file to load a .yaml, .json or .xml file. The converted result appears on the right as you type.
- If the input has a mistake, the result box turns red and shows the line and column. Tap Show in input to jump to that spot.
- Set the Indent (2 or 4 spaces). For XML, choose whether to keep attributes as
@keys, whether to detect numbers, and the root element name. - Tap Copy or Download, or Convert back to check the round trip.
YAML, JSON and XML in one place
All three formats store the same kind of structured data: keys and values, lists and nested sections. JSON is what web APIs and JavaScript use. YAML is the easy-to-read, indentation-based format of Kubernetes manifests, Docker Compose files, GitHub Actions workflows and Spring Boot's application.yml. XML is still everywhere in banking and government data exchange, SOAP services, Android layouts, Maven pom.xml files and RSS feeds. This YAML to JSON converter turns any one of them into any other, and checks the syntax along the way.
Worked example
This YAML:
name: dailytools
ports:
- "8080:80"
env:
TZ: Asia/Kolkata
becomes this JSON:
"app": {
"name": "dailytools",
"ports": [
"8080:80"
],
"env": {
"TZ": "Asia/Kolkata"
}
}
}
and this XML (the single top-level key app becomes the root element):
<app>
<name>dailytools</name>
<ports>8080:80</ports>
<env>
<TZ>Asia/Kolkata</TZ>
</env>
</app>
How the formats map
| Idea | JSON / YAML | XML |
|---|---|---|
| Key and value | "city": "Pune" | <city>Pune</city> |
| Attribute | "@id": "b1" | <book id="b1"> |
| Text beside attributes | "#text": "350" | <price currency="INR">350</price> |
| List | [ โฆ ] or - item | the same element repeated |
| Empty / null | null | <note></note> |
XML has no real list type, so an element that appears once becomes a single value and a repeated element becomes a list. If your code expects a list, check the case with only one item. XML also needs exactly one root element. When your JSON has several top-level keys or is a list, the converter wraps it in <root> (you can rename it). Keys that aren't valid XML names, such as first name or 2fa, are renamed to first_name and _2fa, and the tool tells you.
Common errors it catches
- JSON: a trailing comma before
}or], single quotes instead of double quotes, comments,Trueinstead oftrue, a missing comma between items, and numbers with leading zeros. - YAML: wrong indentation, tabs used for indentation (YAML allows only spaces), an unclosed bracket or quote, and duplicate keys.
- XML: a tag that is never closed, closing tags in the wrong order, and unescaped
&or<in text.
Tips and caveats
- This tool reads YAML 1.2, where
yes,no,onandoffare plain text. Some tools, such as Python's PyYAML, follow the older YAML 1.1 and read them as true/false, so the country codeNOcan turn intofalse. Quote such values to be safe. - JSON numbers longer than 15โ16 digits (bank account numbers, some IDs) lose their last digits in JavaScript. The tool warns you about this. Store such numbers as strings.
- YAML comments are dropped when converting, because JSON and this XML output don't carry them.
- It all runs in your browser. Config files with passwords or API keys aren't uploaded anywhere.