JSON example in JavaScript for beginner

JSON stands for “JavaScript Object Notation“. JSON is a lightweight data-interchange format which is fast and easy for humans to read and write. That means it is really very simple and easy to learn without sparing much time. In another words we can say that JavaScript Object Notation is a lightweight data-interchange format that is completely language independent but with some conventions.

JSON is built on two structures:

Data is in name/value pairs

Each name is followed by : (colon) and value

The name/value pairs are separated by , (comma)

JSON objects are written inside curly brackets,

And JSON arrays are written inside square brackets.

There few ways we can create JSON object with JavaScript. For example:

var JSONObjectName = { “name”: “amin”, ” isMale”: true};

The above code will create an Object with the attribute “name” which contains value in String and “isMale” containing Boolean value. To access attributes of JSON object we can use only “.” operator. Let’s create a JSON object and built a table getting data from JSON object.