YAML is a strict superset of JSON, so defining the former in the syntax of the latter is fully supported by the spec. Perhaps not by every YAML library, to be sure, but those which do not are not conformant. From the YAML spec[0]:
The YAML 1.23 specification was published in 2009. Its
primary focus was making YAML a strict superset of JSON.
0 - https://yaml.org/spec/1.2.2/