YAML To JSON
Convert a deliberately restricted YAML 1.2 Core document into JSON. Unsupported YAML features stop with an explanation instead of being flattened into an ambiguous result.
Parse JSON-Compatible YAML
Declared YAML Profile
| Feature | Policy |
|---|---|
| Version/schema | YAML 1.2 Core via js-yaml 4.3.1 |
| Documents | Exactly one |
| Anchors and aliases | Rejected |
| Custom tags and merge keys | Rejected |
| Mapping keys | String scalars only, including flow mappings |
| Duplicate keys | Rejected |
| Numbers | Finite values only; unsafe integer materialization rejected |
| Cycles | Unavailable because aliases are rejected |
YAML Has Values JSON Cannot Represent Directly
Tags, shared aliases, cycles, complex keys, and multiple documents do not have one universal JSON mapping. Restricting the profile is safer than claiming all YAML can be converted.
Under the selected Core schema, plain yes remains the string "yes" while true is a boolean. Timestamp-like scalars remain strings rather than becoming JavaScript Date values.
Useful Failure Checks
- Resolve duplicate keys before conversion.
- Replace aliases with explicit data only when duplicated values are acceptable.
- Choose one document and string mapping keys before moving into JSON.
Questions About This Tool
Aliases can preserve shared identity or create cycles, neither of which has a direct JSON equivalent.
No. Under the selected YAML 1.2 Core behavior, yes is a string while true is a boolean.
No. The profile requires exactly one document so the JSON root is unambiguous.