EN
JavaScript - convert array to JSON
0
points
In this article, we would like to show you how to convert array to JSON in JavaScript.
Practical example
In this example, we use JSON.stringify() method to convert array to JSON string.
// ONLINE-RUNNER:browser;
var array = [1, 2, 3];
var jsonString = JSON.stringify(array);
console.log(jsonString); // [1,2,3]