JSON to YAML
Paste JSON. Get YAML as you type. Nothing leaves your browser.
- 0
- Lines
- 0
- Keys
- 0
- Errors
On this page
About JSON to YAML Converter
Updated
JSON to YAML Converter turns JSON (JavaScript Object Notation) into YAML (YAML Ain't Markup Language). Paste your JSON into the editor and the YAML shows in the Result pane as you type. Press Convert to jump to the YAML, then Copy or Download it.
The tool checks your JSON at the same time. When something is wrong, it rings the exact spot, gives the line and column, and says how to fix it. Format and Minify tidy the JSON itself. Summary counts the keys, depth and arrays, and Tree shows every key and value.
Customization
Open Options to set the YAML indent, double or single quotes, whether long text stays on one line, and sorting keys A to Z. The tool remembers your choices.
Common JSON to YAML conversions
Simple data structures
A JSON array of simple values, such as ["apple", "banana", "cherry"], becomes a YAML list:
- apple
- banana
- cherryNested objects
Nested JSON objects become indented YAML mappings. The structure stays exactly the same.
{
"name": "John",
"age": 30,
"cars": {
"car1": "Ford",
"car2": "BMW"
}
}name: John
age: 30
cars:
car1: Ford
car2: BMWArrays of objects
JSON arrays of objects are common in many applications. They become YAML sequences of mappings:
[
{ "hobby": "swimming", "experience": 5 },
{ "hobby": "running", "experience": 3 }
]- hobby: swimming
experience: 5
- hobby: running
experience: 3Behind the scenes
The JSON is read by our own strict JSON parser, the same one as in the JSON Validator. The YAML is written by the yaml library, following the YAML 1.2 rules from yaml.org.
Other JSON resources
- The JSON WebsiteThe official website for JSON provides comprehensive information about the data format.
- ECMA-404The official ECMA standard that defines JSON.
- JSON on MDN Web DocsAn in-depth guide to JSON on the Mozilla Developer Network.
- JSON on WikipediaAn extensive article on JSON from the well-known online encyclopedia.
- W3Schools JSON TutorialA beginner-friendly tutorial on JSON from W3Schools.
- RFC 7159The IETF specification for JSON, defining it as a common format for data interchange on the web.
- RFC 8259The IETF specification that obsoletes RFC 7159, further defining the JSON data interchange format.
- JSON Tutorial on TutorialsPointA comprehensive tutorial that covers the basics of JSON.
- JSON Courses on CourseraA collection of courses on JSON offered by Coursera.
- JSON on StackOverflowQuestions tagged JSON give real-world problem solving scenarios.
- The History of JSONA playlist of videos that explain the history of JSON.
- The JSON Logo Design ProcessA playlist of videos that explain the history behind the JSON logo.
- JSON-LDA lightweight Linked Data format that lets you link JSON data to other JSON data anywhere.
- Swagger's Guide on JSON vs XMLA guide comparing JSON with XML for API design.
JSON to YAML FAQ
Why use a JSON to YAML converter?
Converting data by hand is slow and easy to get wrong. The converter turns JSON into YAML in one step, keeps every value and its type, and quotes text that YAML would otherwise read as something else.
What should I do if the conversion fails?
The converter only works on valid JSON. When the JSON has an error, the tool rings the exact spot, gives the line and column, and says how to fix it. Fix it, and the YAML appears.
What should I consider when converting JSON to YAML?
Keep these points in mind:
- Since YAML 1.2, valid JSON is also valid YAML. YAML adds features that JSON does not have, such as comments, anchors and aliases.
- YAML uses indentation for structure, so take care when you change the indents by hand.
- Some text values look like other types in YAML, such as
true,nullor1.0. When such a value is text in your JSON, the converter puts it in quotes so it stays text.
What is the difference between JSON and YAML?
Both store and send structured data. JSON uses brackets and quotes, and is strict and compact. YAML uses indentation, supports comments, and is easier for people to read and edit.
When should I choose YAML over JSON?
Choose YAML for configuration files that people read and edit, such as Kubernetes, Docker Compose or GitHub Actions files. Choose JSON for data that programs send to each other, such as API responses.
Can I convert YAML back to JSON?
Yes. Paste your YAML into the YAML Formatter and open its JSON tab.