Skip to main content

JSON

JSON means JavaScript Object Notation. JSON is used in lots of places. It is very easy to use because JSON can directly be imported into JavaScript and be parsed as a JavaScript Object. It's great!

A JSON file can contain an object or an array of objects. Every key in the object is a string, and every value of every parameter can be either a string, number, boolean, object, null, or an array of multiple of those. These are the primitive types that are also used in JavaScript. In JavaScript, however, there is also undefined. This is not supported in JSON.

This is an example of a JSON file.

{
"position": 4,
"label": "Beginner",
"collapsible": true,
"collapsed": false,
"object": {
"key1": "hey",
"key2: ["test",1,2,3]
},
"arrayKey": [],
"nullValue": null
}

JSON is very flexible. With just a couple of type primitives, it gives you unlimited possibility to store almost any data in JSON files.

Please note that it's possible to have multiple types of values in a single array, but I don't recommend to do that because it makes it harder to process your data.

Did you learn something?

Click the button below to tweet about what you thought of this section, what you've made, what you learned... Also don't forget to share it with us via slack! Cool tweets (or other social media posts) will be selected and presented on this page!

Tweet!