How to Convert YAML and JSON
Choose a direction, paste structured data or open a local file, and review the conversion that appears while you edit. The validator reports syntax problems before creating output, so you can correct the source and then copy or download the converted file.
1. Add source data
Paste YAML or JSON, load the sample, or open a .yaml, .yml, or .json file.
2. Validate and inspect
Review syntax feedback, the reported line and column, and the structure statistics.
3. Export the result
Choose two- or four-space indentation, then copy or download the converted output.
YAML vs JSON: What Changes?
YAML uses indentation and supports features such as comments, anchors, aliases, tags, and multiple documents. JSON uses braces, brackets, quoted property names, and a smaller data model designed for portable data exchange. Both can represent objects, arrays, strings, numbers, booleans, and null values.
| Data concept | YAML | JSON |
|---|---|---|
| Mapping | Indented key-value pairs | Object with { } |
| Sequence | Dash-prefixed items or [ ] | Array with [ ] |
| Scalar types | Strings, numbers, booleans, null | Strings, numbers, booleans, null |
| Comments | Supported with # | Not supported |
| Multiple documents | Supported with --- | One root value per document |
Type Handling and Quoted Values
Plain YAML scalars can be interpreted as numbers, booleans, or null. Quote identifiers such as version numbers, leading-zero codes, and values that must stay strings. The converter follows YAML 1.2 parsing behavior, so older YAML 1.1 forms may not receive the type some legacy parsers assign to them.
JSON cannot represent non-finite numbers, undefined values, custom YAML tags, circular references, or arbitrary mapping-key types. Incompatible input is rejected instead of being silently changed into misleading JSON.
Anchors, Aliases, and Multiple Documents
YAML anchors and aliases are resolved into ordinary JSON-compatible values. A safety limit controls alias expansion, and circular aliases are rejected because JSON cannot contain circular structures. When the source has multiple YAML documents separated by ---, the converter returns a JSON array containing one value per document.
What a Round Trip Cannot Preserve
Conversion preserves compatible represented data, not the original source formatting. YAML comments, anchors, aliases, directives, custom tags, quote choices, block scalar styles, and document markers have no direct JSON equivalent. Converting the generated JSON back to YAML creates clean YAML, but it cannot reconstruct those original authoring details.
YAML and JSON Standards
For formal syntax and data-model details, consult the YAML 1.2.2 specification and the JSON standard in RFC 8259. External references open in a new tab.
Private, Browser-Based Conversion
Parsing, validation, conversion, copying, and file creation run locally in your browser. Opened files are read on your device and do not need to be uploaded to perform the conversion. Refreshing the page clears the current workspace.
Continue Your Developer Workflow
Inspect JSON in detail with the JSON Formatter & Validator, check markup using the XML Formatter & Validator, transform spreadsheet data with the CSV ↔ JSON Converter, or generate application types with the JSON to TypeScript Converter.