javascript array with objects to string

JavaScript
var array = new Array(); //new Array not necessary
var string;

array[0] = {key: value};
array[1] = {key1: value1};

string = JSON.stringify(array);

/*
string should look like
[{"key":"value"},{"key1":"value1"}]
*/
Source

Also in JavaScript: