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.
In this example, we use JSON.stringify()
method to convert array
to JSON string.
xxxxxxxxxx
1
var array = [1, 2, 3];
2
3
var jsonString = JSON.stringify(array);
4
5
console.log(jsonString); // [1,2,3]