GUIDE深度 · Deep dive
JSON vs YAML
JSON is strict and universally supported, good for APIs; YAML is more readable and supports comments, good for configs. YAML's implicit typing and indentation sensitivity also make it easier to get wrong.
Comparison
JSON: braces/brackets, double quotes, no comments.
YAML: indentation, comments, unquoted strings.
Conversion notes
YAML yes/no/on/off can become booleans; quote when needed.
JSON numbers and strings are explicit; keep them distinct in YAML.
FAQ
Which for config?
YAML for humans, JSON for machine exchange.
Can YAML express all JSON types?
Yes, but watch implicit typing and special characters.