YAML is best suited for configuration where JSON is better as a serialization format or serving up data for your APIs.

YAML has a different feature set than JSON, including but not limited to:

  • the ability to self reference
  • support for complex datatypes
  • embedded block literals
  • comments

It is also better suited for human readability

YAML parsers are younger and have also been known to be less secure


JSON is best suited as a serialization format. It is much more explicit and strict than YAML. It is a very popular format for transmitting data over http.

YAML is a superset of JSON, which means you can parse JSON with a YAML parser.

Try mixing JSON and YAML in the same document: [..., ..] for annotating arrays and { "foo" : "bar"} for objects.

convert YAML to JSON