Skip to main content

YAML vs JSON

Basically, both JSON and YAML were developed to provide a human-readable data interchange format.

YAML is implemented as a superset of the JSON format. This means that we can parse JSON using a YAML parser.

The following are some key differences between YAML and JSON:

YAMLJSON
Complex and time consuming process of parsing Serialized dataQuickly and easily parse JSON serialized data with its simpler design
Less community supportLarger community support and popularity
Supports commentsDoesn’t support comments
Ability to use reference of other data objectsImpossible to serialize complex structures with object references
Hierarchy is denoted by using double space characters. Tab characters are not allowedObjects and Arrays are denoted in braces and brackets.
String quotes are optional but it supports single and double quotes.Strings must be in double quotes.
Root node can be any of the valid data typesRoot node must either be an array or an object.
note

You can learn more about JSON in our JSON Tutorial