• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Overview
2
3Though JSON is a ubiquitous data format, it is not a very compact format suitable for data exchange, for instance over a network. Hence, the library supports
4
5- [BSON](bson.md) (Binary JSON),
6- [CBOR](cbor.md) (Concise Binary Object Representation),
7- [MessagePack](messagepack.md), and
8- [UBJSON](ubjson.md) (Universal Binary JSON)
9
10to efficiently encode JSON values to byte vectors and to decode such vectors.
11
12## Comparison
13
14### Completeness
15
16| Format      | Serialization                                 | Deserialization                              |
17| ----------- |---------------------------------------------- | -------------------------------------------- |
18| BSON        | incomplete: top-level value must be an object | incomplete, but all JSON types are supported |
19| CBOR        | complete                                      | incomplete, but all JSON types are supported |
20| MessagePack | complete                                      | complete                                     |
21| UBJSON      | complete                                      | complete                                     |
22
23### Binary values
24
25| Format      | Binary values | Binary subtypes |
26| ----------- | ------------- | --------------- |
27| BSON        | supported     | supported       |
28| CBOR        | supported     | not supported   |
29| MessagePack | supported     | supported       |
30| UBJSON      | not supported | not supported   |
31
32See [binary values](../binary_values.md) for more information.
33
34### Sizes
35
36| Format             | canada.json | twitter.json | citm_catalog.json | jeopardy.json |
37| ------------------ | ----------- | ------------ | ----------------- | ------------- |
38| BSON               | 85,8 %      | 95,2 %       | 95,8 %            | 106,7 %       |
39| CBOR               | 50,5 %      | 86,3 %       | 68,4 %            | 88,0 %        |
40| MessagePack        | 50,6 %      | 86,0 %       | 68,5 %            | 87,9 %        |
41| UBJSON             | 53,2 %      | 91,3 %       | 78,2 %            | 96,6 %        |
42| UBJSON (size)      | 58,6 %      | 92,3 %       | 86,8 %            | 97,4 %        |
43| UBJSON (size+type) | 55,9 %      | 92,3 %       | 85,0 %            | 95,0 %        |
44
45Sizes compared to minified JSON value.
46