JSON and YAML both represent the same kinds of structured data - objects, arrays, scalars - but with very different ergonomics. JSON uses braces and quotes and is unforgiving; YAML uses indentation and reads more like prose, which is why it dominates config files.
The catch is that YAML's flexibility invites subtle bugs, especially around whitespace and implicit typing. JSON's strictness is annoying to hand-write but rock-solid for machines. Most stacks use both.
