JSON Array - It can store multiple values of type string, number, object, array, boolean, or null.JSON value must be separated by a comma and it is always placed inside the square bracket[]
.
JSON Array is of different types such as JSON array of string, JSON array of numbers, JSON array of Booleans, JSON Array of Objects, and JSON multidimensional array.
Let us see the example of JSON string data.
'["Ford", "BMW", "Fiat"]'
Inside the JSON string,a JSON array literal is exist.
["Ford", "BMW", "Fiat"]
From the above JSON literal, it is clear that JSON literal is similar to a Javascript array.
Please keep in mind that array values can be of different types such as string, number, boolean, object, array, null, etc.
Source Code
var fruits = ["orange", "grapes", "mango"];
Accessing Array value through index such as ArrayName[index];
Javascript array can be created easily by parsing JSON string.
Source Code
var fruits = '["mango", "orange", "banana"]';
jsArrayOffruits = JSON.Parse(fruits);
Source Code
var users = '{"name":"Smith", "age":30, "fruits":["mango", "orange", "banana"]}';
var jsObj = JSON.parse(users);