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.

更新 2026-10-31 · 公式可核验

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.

Sources

Related calculators

JSON to YAMLConvert JSON objects and arrays to indented YAML, including nesting and special-character quoting.

More guides

YAML Subset Supported HereRead guide