What is JSON

Go back to Tutorial

JSON is a human-readable text format that facilitates data interchange between different programming languages. JavaScript Object Notation (JSON) is an open, human and machine-readable standard that facilitates data interchange, and along with XML is the main format for data interchange used on the modern web. JSON supports all the basic data types you’d expect: numbers, strings, and boolean values, as well as arrays and hashes.

Document databases such as MongoDB use JSON documents in order to store records, just as tables and rows store records in a relational database. Here is an example of a JSON document:

{

‘_id’ : 1,

‘name’ : { ‘first’ : ‘John’, ‘last’ : ‘Backus’ },

‘contribs’ : [ ‘Fortran’, ‘ALGOL’, ‘Backus-Naur Form’, ‘FP’ ],

‘awards’ : [

{

‘award’ : ‘W.W. McDowell Award’,

‘year’ : 1967,

‘by’ : ‘IEEE Computer Society’

}, {

‘award’ : ‘Draper Prize’,

‘year’ : 1993,

‘by’ : ‘National Academy of Engineering’

}

]

}

A JSON database returns query results that can be easily parsed, with little or no transformation, directly by JavaScript and most popular programming languages – reducing the amount of logic you need to build into your application layer.

A JSON document contains text, curly braces, square brackets, colons, commas, double quotes, and maybe a few other characters.

But probably the most prominent thing about JSON, is that its data consists of name/value pairs. These name/value pairs reflect the structure of the data. Even if you don’t know JSON, you should be able to get a basic idea of the data structure just by looking at the way data is stored in the above JSON file.

Binary JSON (BSON)

MongoDB represents JSON documents in binary-encoded format called BSON behind the scenes. BSON extends the JSON model to provide additional data types, ordered fields, and to be efficient for encoding and decoding within different languages.

Go back to Tutorial

Share this post
[social_warfare]
MongoDB Database
Database and JSON

Get industry recognized certification – Contact us

keyboard_arrow_up