As I embark on my journey to learn JSON, I've encountered an issue while attempting to create an array of object Messages. The declaration seems to be error-free, but when I try to access it using the code snippet below:
serverReply2.Mesages[0].Date
, I encounter the following error:
Uncaught TypeError: Cannot read property '0' of undefined
Here's the relevant portion of the code:
this.serverReply2 = {"Messages": [
{"Date": "1/1/1",
"Message": "test messageA",
"Attachments": ["link2","link2"]},
{"Date": "1/1/2",
"Message": "test messageB",
"Attachments": ["link2","link2"]},
{"Date": "1/1/3",
"Message": "test messageC",
"Attachments": ["link2","link2"]},
]
};
alert( serverReply2.Mesages[0].Date );