var students = [
{
id: 'st01',
name: 'Name 1',
age: 20
},
{
id: 'st02',
name: 'Name 2',
age: 21
},
{
id: 'st03',
name: 'Name 3',
age: 22
}
];
var str = JSON.stringify(students);
console.log(str);
Output
[{"id":"st01","name":"Name 1","age":20},{"id":"st02","name":"Name 2","age":21},{"id":"st03","name":"Name 3","age":22}]