Convert a YAML document to JSON
Paste one YAML document to convert it. For example, name: Alice and age: 30 on separate lines becomes {"name":"Alice","age":30}, displayed with indentation. YAML mappings become JSON objects and sequences become arrays.
The parser uses js-yaml's default schema. Quote values that must stay strings, such as code: "0012". Unquoted values can resolve to numbers, booleans, null, or dates. Inspect the output types before using it in an API or configuration.
Know which YAML details JSON cannot keep
Comments and presentation details do not appear in JSON. Anchors and aliases are resolved to data rather than preserved as YAML syntax. Unknown custom tags and multiple YAML documents produce an error. Circular alias structures cannot be serialized as JSON.
This is a data conversion, so returning the output through the JSON to YAML converter will not restore the original comments, aliases, or layout. Use the JSON Schema validator if you also need to check supported constraints on the converted values.
Common questions
- Are YAML comments included in the JSON?
- No. Comments describe the YAML source and do not become JSON data. The converter also writes new formatting.
- Can I convert several YAML documents at once?
- No. This tool parses one document. Split a YAML stream into individual documents before converting it.