JSON vs YAML

Both formats represent the same basic data shapes (maps, lists, strings, numbers, booleans) but they read and parse very differently. Convert between them with JSON to YAML and YAML to JSON.

JSON YAML
Syntax Braces { } and brackets [ ] delimit structure explicitly Significant whitespace/indentation delimits structure, similar to Python
Comments Not supported, no comment syntax in the spec Supported with #
Spec One specification, RFC 8259 YAML 1.1 and YAML 1.2 both exist and differ in some scalar-parsing rules; most parsers today implement 1.1 or a 1.2 subset
Relationship Any valid JSON document is parseable as YAML (JSON is effectively a compatible subset of YAML's flow style) Supersets JSON's data model with extra features JSON doesn't have
Extra features None beyond basic maps/lists/scalars Anchors & references (&anchor / *anchor) to reuse a value, and multi-document files separated by ---
Parsing speed / ambiguity Faster to parse, and unambiguous, a given document parses one way Slower and has known footguns, e.g. the "Norway problem," where an unquoted NO is parsed as the boolean false under YAML 1.1's implicit typing rules
Where it dominates APIs and web data interchange, the universal format for HTTP request/response bodies Configuration files, Kubernetes manifests, Docker Compose, GitHub Actions / CI pipelines, Ansible playbooks

Which one do I want?

If you're sending or receiving data over an API, JSON is the default, compact, unambiguous, and parsed natively by every language's standard library. If you're hand-writing a config file that benefits from comments and a less symbol-heavy syntax, YAML is the convention, most CI and infrastructure tools (Kubernetes, Docker Compose, GitHub Actions) use it for exactly that reason. When a value could be misread as a boolean, number, or date in YAML (the "Norway problem" and similar cases), quote it explicitly.