JSON To YAML
Serialize one JSON value with js-yaml 4.3.1 using its YAML 1.2 Core schema. The output is a chosen style, not a universal canonical YAML representation.
Serialize JSON As YAML
Parser And Serializer Boundary
JSON is parsed first, then materialized and serialized by js-yaml 4.3.1 with the Core schema, references disabled, key order retained, and a 100-column line-width preference.
Number spelling and quote style may normalize. Unsafe integers and non-finite JavaScript Number materialization are rejected rather than rounded silently. JSON comments do not exist and cannot become YAML comments.
Representative Values
| JSON value | YAML consideration |
|---|---|
| "001" | Remains a quoted string |
| "yes" | Remains a string under YAML 1.2 Core behavior |
| true | Boolean |
| Root array or scalar | Supported |
| Duplicate object name | Rejected for this conversion |
Before Using The YAML
- Confirm the destination supports YAML 1.2 Core semantics.
- Review quote style when strings resemble booleans or numbers.
- Do not expect anchors, aliases, tags, comments, or custom object identity to be invented from JSON.
Questions About This Tool
No. YAML supports multiple equivalent styles. This tool uses the documented js-yaml dumper choices.
The serializer materializes numbers through JavaScript Number. Rejecting values beyond its exact integer range avoids silent digit changes.
The serializer retains source object order, but applications should not treat mapping order as a universal semantic contract unless their profile says so.