How to create a JSON Array?

An array is an ordered collection of values. An array begins with [ (left bracket) and ends with ] (right bracket). Values are separated by , (comma).
JSON Array
(i) Empty Array:- that array has not value is called Empty Array.Empty Array always return, undefine value.
[php]
<script>
var myarr=[];
document.write(myarr[0]); //Output:- undefined
</script>
[/php]
(ii) Array of strings:- In the below eg. array has 3 string values. array index start 0.
[php]
<script>
var myarr=["John","Tony","Alix"];
document.write(myarr[0]); //Output:- John
document.write(myarr[1]); //Output:- Tony
document.write(myarr[2]); //Output:- Alix
</script>
[/php]
(iii) Array of Numbers:- In the below eg. array has 3 number values.
[php]
<script>
var myarr=[11,12,13];
document.write(myarr[0]); //Output:- 11
document.write(myarr[1]); //Output:- 12
document.write(myarr[2]); //Output:- 13
</script>
[/php]
(iv) Array of Booleans :- In the below eg. array has 3 boolean values.
[php]
<script>
var myarr=[true,false,true];
document.write(myarr[0]); //Output:- true
document.write(myarr[1]); //Output:- false
document.write(myarr[2]); //Output:- true
</script>
[/php]
(v) Array of Array :- In the below eg. array has 2 array.
[php]
<script>var myarr=[
["a","b","c"],["x","y","z"]
];
document.write(myarr[0][0]); //Output:- a
document.write(myarr[0][1]); //Output:- b
document.write(myarr[0][2]); //Output:- c
document.write(myarr[1][0]); //Output:- x
document.write(myarr[1][1]); //Output:- y
document.write(myarr[1][2]); //Output:- z
</script>
[/php]
(vi) Array of Objects:- In the below eg. array has 2 object values.
[php]
<script>
var myarr_data = [ {}, {}, {}, {}, {} ];
myarr=[{name:"john",age:27},{name:"tony",age:28}]
document.write(myarr[0].name); //Output:- john
document.write(myarr[0].age); //Output:- 27
document.write(myarr[1].name); //Output:- tony
document.write(myarr[1].age); //Output:- 28
</script>
[/php]

(vii) Array with Mixed Data Types:-
[php]
<script>
var myarr_data = [ {}, "text",11,null,true,[] ];
</script>
[/php]