I have written code to serialize objects to JSON and BSON. According to my output, the BSON produced is greater in size than the JSON. Is this expected?
From my
The property "foo":"bar"
consumes 11 bytes in UTF-8 encoded JSON. In BSON it consumes 13:
bytes description
============================================
1 entry type value \x02
3 "foo"
1 NUL \x00
4 int32 string length (4 -- includes the NUL)
3 "bar"
1 NUL \x00
There are many cases in which JSON will be more compact.