What actually changes
A JSON object becomes a YAML mapping, commonly displayed as key-value lines. A nested object is indented and an array usually becomes dash-prefixed sequence items. Those changes describe the parsed structure, not new application behavior: converting an arbitrary API response does not make it a valid Kubernetes manifest or workflow.
The emitter chooses a YAML representation for each value. Strings may be plain, quoted or block scalars; numbers, booleans and null use scalar forms. Key enumeration follows JavaScript rules, so array-index-like keys can be reordered even when ordinary string keys retain their source order.
The output has no comments because JSON has none to supply. You can add them afterwards, but keep that YAML file as the authoring source if the comments matter. A later trip through JSON cannot carry those annotations back.
When a string still needs its quotes
A string such as "1.10" must remain distinguishable from the number 1.1. Similarly, a quoted JSON identifier with leading zeros should still be a string after YAML parsing. Let the emitter choose quoting, then test the destination rather than stripping quotes because the file looks cleaner without them.
The yaml library defaults to YAML 1.2 core scalar rules. Bare yes, no, on and off are strings under those rules, unlike the YAML 1.1 boolean convention. The generated YAML may therefore look safe here and be read differently by a destination using YAML 1.1. Quote ambiguous words explicitly when handing the result to such a consumer.
Leading-zero numbers are version-sensitive too. Under YAML 1.2 core rules, 0755 is decimal 755 and 0o755 is octal 493; 08080 is decimal 8080, not an invalid octal value. Under YAML 1.1, 0755 has different meaning. Preserve identifiers as quoted strings instead of using parser-version differences as a data model.
Long strings and multi-line text
The emitter disables automatic line-width wrapping. That is helpful when a long URL, command or value must not acquire layout changes. Existing newline characters may still use YAML block-scalar notation, which is a representation of the string rather than an instruction to wrap an arbitrary line.
A literal block introduced by a pipe preserves line breaks; a folded block introduced by a greater-than sign applies folding rules. Chomping indicators control the end: pipe-minus strips the final newline, a plain pipe clips it to one, and pipe-plus keeps trailing newlines. These distinctions matter for scripts and other whitespace-sensitive values.
Do not choose a block style only for appearance. Convert the edited YAML back and compare the resulting string, including its final newline, with the intended JSON string. A file that looks identical in a text editor can still contain a different terminal newline.
The documents that have no clean YAML form
Unusual JSON property names are legal data, including empty strings, embedded newlines and punctuation. YAML can represent such keys, but the resulting quoting or explicit-key notation may be harder to read than the original JSON. Converting notation does not improve an awkward data model automatically.
Very deep nesting makes indentation hard to follow. If reviewers have to count ten levels of spaces to locate a setting, changing the format is not enough. An editor with indentation guides or a schema-aware configuration view may be a better improvement.
The numerical and duplicate-key limits occur before the emitter runs. A 64-bit identifier written as a JSON number can round; a duplicate member can disappear; a huge exponent can become a non-finite JavaScript number. A YAML round trip cannot recover source information lost by JSON.parse.
Checking the result
Validate the untouched JSON first, especially when duplicate keys are possible. Convert, then parse the YAML using the actual consumer or the YAML-to-JSON tool. Compare parsed values rather than indentation, quotes or numeric spelling.
That comparison checks the value after parsing, not the original text. Comparing against JSON.parse of the original will not detect a large integer already rounded by both paths. Keep exact identifiers and high-precision amounts as strings from the beginning when those digits must survive.
The destination remains the authority for schema and version compatibility. A general converter does not check required Kubernetes fields, supported workflow keys or application-specific tags. Use the target system’s validation or dry-run command before replacing a working configuration.
yaml library documentation — Primary documentation for the parser and emitter, including version, schema and stringification options.