I have the following JSON:
{"title":"MYTITLE","employer":"MYEMPLOYER","weekends":[["6"],["8"],["15"]]}
I need to access weekends to get this:
6
8
15
Here is my try:
var json = $.parseJSON(data);
for (var i = 0, len = data.weekends.length; i < len; i++) {
console.log(data.weekends[i]);
}
But results are empty in chrome console log...if I understand correctly...i read length of json converted to an array and for in loop I read the value in the index array.
But I always get the error:
Uncaught TypeError: Cannot read property 'length' of undefined
Why is weekends length undefined? I set command length and it does not recognize it is an array and to count length so that for loop can work.