JSON stands for Javascript Object Notation. JSON is a text-based data format that is used to store and transfer data.
Syntax-
In JSON, the data are inย "key/value" pairs separated by a commaย " , ".
JSON was derived from JavaScript. So, the JSON syntax resembles JavaScript object literal syntax. However, the JSON format can be accessed and created by other programming languages too.
JSON Data -
JSON data consists ofย "key/value"ย pairs similar to JavaScript object properties. The key and values are written in double quotes separated by a colonย " : ".
โก๏ธExample-
JSON Object -
The JSON object is written inside curly bracesย `{ }`. JSON objects can contain multipleย "key/value"ย pairs.
โก๏ธExample-
JSON Array -
JSON array is written inside square bracketsย `[ ]`.
โก๏ธExample-
Accessing JSON Data -
You can access JSON data using the dot notation.
โก๏ธExample-
JavaScript Objects VS JSON -
Though the syntax of JSON is similar to the JavaScript object, JSON is different from JavaScript objects.
Converting JSON to JavaScript Object -
You can convert JSON data to a JavaScript object using the built-inย `JSON.parse()`ย function.
โก๏ธExample-
Converting JavaScript Object to JSON -
You can also convert JavaScript objects to JSON format using the JavaScript built-inย `JSON.stringify()`ย function.
โก๏ธExample-
Use of JSON:
JSON is the most commonly used format for transmitting data (data interchange) from a server to a client and vice-versa.
JSON data are very easy to parse and use. It is fast to access and manipulate JSON data as they only contain text.
JSON is language-independent. You can create and use JSON in other programming languages too.
If you want to learn more about โ JSON โ then you can also go through it
If you enjoyed reading this thread, please do the following: 1. Like the threadโค๏ธ 2. Retweet the first tweet.๐ 3. Follow me and enable notifications: โ @CodeMarch
Thank you for reading all the way through.
[0] is the first element.
[1] is the second element.
[2] is the third element.
๐๐ต๐ฎ๐ป๐ด๐ถ๐ป๐ด ๐ฎ๐ป ๐๐ฟ๐ฟ๐ฎ๐ ๐๐น๐ฒ๐บ๐ฒ๐ป๐.
we can change the value of the elements in an array.
๐๐ ๐ฎ๐บ๐ฝ๐น๐ฒ: