0

Convert array to JSON in JavaScript

JavaScript
var myArray = [{param1: 'test'}, {param2: 'test2'}];

var myJsonString = JSON.stringify(myArray);

console.log(myJsonString); // "[{\"param1\":\"test\"},{\"param2\":\"test2\"}]"
RUN
add comment
Suggest a different solution or add another example