I am working on the code below;
var data = [];
data['id'] = 105;
data['authenticated'] = true;
console.log(data);
var jsonData = JSON.stringify(data);
console.log(jsonData);
The initial console.log is displaying;
[id: 105, authenticated: true]
However, the final console.log is just showing an empty array. I would like to convert the array into a json object. Is there something I am overlooking?
Appreciate any help!