Open JSON File

Information, tips and instructions

JSON Alternatives

JSON is one of the most popular languages to describe complex and structured data. Still it is not the only one available.

BSON

BSON or Binary JSON is a binary version of JSON language. It has similar structure to the JSON except it stores all the data definitions and data itself in a binary format. This makes it more compact and also faster to parse by applications. Output of BSON documents is also faster because less information is being written out. BSON is popular for many applications which already work with JSON. For example, MongoDB uses BSON to store document objects inside the database. Due to its smaller size BSON is also frequently used to exchange serialized data over the network.

YAML

YAML is a structured data language often used as a replacement or together with JSON. YAML was developed during the same years as JSON and is very similar to it. YAML is more readable since it uses tabulation instead of curly braces. It also supports comments while JSON doesn’t. Since YAML structure is very similar to JSON certain YAML parsers can also parse JSON. Conversion from JSON to YAML and vice versa is also very easy.

Some advanced features missing from JSON are available in YAML. This includes anchor references when parts of the YAML documents could be reused later in the document. Using anchor references can considerably decrease document size. YAML also support explicit typing of the data entries and custom data types.

Below are examples of YAML and corresponding JSON data objects.

employee:
name: John Doe
age: 30

“employee”: {
“name”: “John Doe”,
“age”: 30
}

XML

XML was a very popular choice for data processing since the 1998 when it was first defined. It was used for multiple applications both on client and server. The syntax of XML is more complex since it requires opening and closing tag for every nested element which also makes XML files larger in size.

<employee>
 <name>John Doe</name>
 <age>30</age>
</employee>

“employee”: {
 “name”: “John Doe”,
 “age”: 30
}

MessagePack

MessagePack is a binary data serialization language. It has similar data types to JSON but it restricts integer, string, arrays and binary object sizes. Also, certain sequences of characters in string are not MessagePack compatible. Strings in MessagePack are typically stored in UTF-8 or Binary format. To save space complex structures in MessagePack are stored as arrays where odd items store keys and even items store values.

MessagePack is a popular choice for networking applications because it allows to generate messages smaller in size than JSON, BSON and YAML would allow.