What is BSON ?

 Posted by Sagnikmukh on 4/30/2011 | Category: Others Interview questions | Views: 4837 | Points: 40

BSON is a bin­ary-en­coded seri­al­iz­a­tion of JSON-like doc­u­ments. BSON is designed to be lightweight, traversable, and efficient. BSON, like JSON, supports the embedding of objects and arrays within other objects and arrays.BSON supports all JSON types (objects, arrays, strings, integers, etc). BSON supports some additional types, most notably binary data, making it a superset of JSON.

The two major benefits of BSON over JSON are size and speed. BSON stores binary data directly, avoiding the time overhead and the additional size of base64 encoded text that regular JSON has with binary data. Reading and writing BSON is also faster than JSON.

Example :

{"hello": "world"} ? "\x16\x00\x00\x00\x02hello\x00\x06\x00\x00\x00world\x00\x00"

For more Details : http://bsonspec.org/

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response