I'm attempting to convert an array to JSON to be sent to a client. Here is what the data looks like in console:
[ NL: [ true, true, true, true, true, true, true, true, true, true, true, true ],
LU: [ true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
true,
false,
false,
false ],
SE: [ false, false, false ] ]
However when I run this (res being an express.js socket):
console.log(st.bot.serverStatus);
res.send(JSON.stringify(st.bot.serverStatus));
I get the output in console like expected, but I get [] from the web browser. What am I doing wrong?
PS: I am unable to change the format of the elements, they are generated by this method:
if(st.bot.serverStatus[tmp.country] !== undefined) {
st.bot.serverStatus[tmp.country][st.bot.serverStatus[tmp.country].length] = alive;
} else {
st.bot.serverStatus[tmp.country] = [ alive ];
}
st.bot.serverStatus?