Shortest
The shortest way I know toTo generate valid json from array of integers isuse
let json = `[${cars}]`
for more general object/arrayarrays use JSON.stringify(cars) (for object with circular references use this)
let cars = [1,2,3]; cars.push(4,5,6);
let json = `[${cars}]`;
console.log(json);
console.log(JSON.parse(json)); // json validation