84
rated 0 times
[
85]
[
1]
/ answers: 1 / hits: 24473
/ 9 Years ago, fri, february 13, 2015, 12:00:00
Here's my array (from Chrome console):
Here's the pertinent part of code:
console.log(hours);
var data = JSON.stringify(hours);
console.log(data);
In Chrome's console I get []
from the last line. I should get {'Mon':{...}...}
Here is the minimal amount of JavaScript to reproduce the issue:
var test = [];
test[11h30] = 15h00
test[18h30] = 21h30
console.log(test);
console.log(JSON.stringify(test)); // outputs []
I tried some other stuff like
Convert array to JSON or Convert javascript object or array to json for ajax data but the problem remains.
More From » arrays