YAML is a superset of JSON — it is explained in more detail here:
YAML is primarily a data serialization language. XML was designed to be backwards compatible with the Standard…yaml.org
The thing to note is that JSON is always convertible to YAML. So if you have a datafile in JSON or restrict yourself to JSON functionality in YAML, you can convert between them without any loss of information. The formats look very different, but functionally they are the same (for the JSON subset of functionality).