About this tool
The YAML to JSON converter translates YAML mappings, sequences, scalars, and multiple documents into JSON, then converts JSON back into readable YAML. One YAML document becomes its own value. When the input contains several documents separated by document markers, their values are combined into one JSON array and the page states how many were combined.
Conversion updates after a short typing delay and runs entirely in the browser with the YAML package. YAML parser messages include available line and column positions, while malformed JSON shows its native parse message and character position. Choose two-space or four-space indentation, open YAML or JSON files, and copy or download the generated data without sending it away.
How to use the YAML ↔ JSON
- 1Select YAML to JSON or JSON to YAML conversion.
- 2Paste source text, use Sample, or open a supported local file.
- 3Choose two or four spaces for generated nested indentation.
- 4Wait briefly for live conversion and correct any displayed syntax error.
- 5Copy the output or download data.json or data.yaml.
Features
Multi-document YAML reading
Parse every YAML document and combine multiple values into a clearly noted JSON array.
Located YAML diagnostics
Display parser messages with line and column details when the YAML library supplies a source position.
Delayed live translation
Refresh the opposite format roughly a quarter second after edits rather than requiring a conversion button.
Selectable nested indentation
Format generated JSON and YAML using either two or four spaces according to project style.
Matching data downloads
Save YAML conversion as data.json and reverse conversion as data.yaml with appropriate content types.
Frequently asked questions
What happens when YAML input has several documents?
Each document is parsed independently, then all document values are placed into one JSON array. A note beneath the editors reports the exact number of YAML documents combined.
Will YAML comments appear in converted JSON?
No. JSON has no comment syntax, so conversion preserves the represented data values rather than YAML comments, anchors as written, or formatting choices from the source text.
How are YAML syntax errors located?
The parser error is shown with its message and, when available, a line and column taken from the YAML error linePos information. This points to the area that needs correction.
Does JSON to YAML preserve the original JSON spacing?
No. JSON is parsed into a value and YAML is generated from that value using the selected two-space or four-space indentation. Data order and values are retained by normal JavaScript parsing rules.
Does YAML or JSON source leave the device?
No. Text entry, local file reading, parsing, stringification, copy actions, and generated downloads are handled in the browser and are not submitted to a conversion service.