MongoDB Dev and Admin (15 Blogs) Become a Certified Professional

Introduction to JSON & BSON in MongoDB

Last updated on May 22,2019 4.1K Views

MI-new-launch

myMock Interview Service for Real Tech Jobs

myMock-mobile-banner-bg

myMock Interview Service for Real Tech Jobs

  • Mock interview in latest tech domains i.e JAVA, AI, DEVOPS,etc
  • Get interviewed by leading tech experts
  • Real time assessment report and video recording

What is JSON?

JSON is JavaScript Object Notation. It is a light-weight data interchange format, which can get transferred from one system to the other easily. It is easy to read and write this format. It is also not a complex task for machines to parse and generate. The text format is completely language independent.

At high level, JSON will have two things- An object and an array. An object is a collection of name/value pairs and an array is an ordered list of values.With the combination of two, you can have a complete JSON structure. The maximum amount of documents that one can embed in a document is 100. This is a very important factor while working with MongoDB.

So an object will start with curly braces and end with curly braces and then comes the key and value. An array will start with the normal, non-curly brackets, then comes value and comma. There are data types that can be supported. See the image below to understand it better.

What is BSON?

BSON is nothing but Binary JSON i.e Binary JavaScript Object Notation. Unlike JSON, it is not in a readable format. It supports the embedding of documents and arrays within other documents and arrays. Like JSON, it is easy for machines to parse and generate. For more information on both these topics, you can always get an insight from various sources. When you check the websites for information, you will see the difference in JSON and BSON and understand how different the two are in terms of readability.

Got a question for us? Mention them in the comments section and we will get back to you.

Related Posts:

Understanding Journaling in MongoDB

Introduction to MongoDB tools

Get started with MongoDB

Comments
1 Comment

Browse Categories

Subscribe to our Newsletter, and get personalized recommendations.