Data model
Straightforward mappings and sequences convert better than YAML-specific features
JSON supports objects, arrays, strings, numbers, booleans, and null. YAML can additionally express anchors, aliases, tags, comments, multiline styles, and other presentation details. Conversion to JSON expands or loses features that have no JSON equivalent, and converting back will not recreate the original YAML source.
Scalars
Quoting prevents values from being reinterpreted by another YAML parser
Values that resemble booleans, null, dates, timestamps, numbers, or strings with leading zeros can be resolved differently by parser version or schema. Force quotes when exact text matters, especially for IDs, ports, dates, yes/no words, and environment values. Check multiline strings and special characters carefully.
Target validation
Valid YAML is not automatically valid configuration for Kubernetes, CI, or another application
Indentation and syntax are only the first layer. The destination can require keys, types, versions, and semantic relationships. Run its schema validator, linter, or dry-run command after conversion, and keep secrets out of online examples and committed configuration.