I'm just learning json. I'm trying to create an array of object Messages, The declaration does not give me a error, but when I try to access it using the following code serverReply2.Mesages[0].Date, i get an error:

Uncaught TypeError: Cannot read property '0' of undefined

code:

 this.serverReply2 = {"Messages": [
    {"Date": "1/1/1",
      "Mwessage": "test messageA",
      "Attachmentsd": ["link2","link2"]},

 {"Date": "1/1/2",
      "Mwessage": "test messageB",
      "Attachmentsd": ["link2","link2"]},

 {"Date": "1/1/3",
      "Mwessage": "test messageC",
      "Attachmentsd": ["link2","link2"]},     
 ]
 };

 alert( serverReply2.Mesages[0].Date );
link|improve this question

77% accept rate
7  
You have written Mesages instead of Messages. – Gazler Jan 16 at 22:19
2  
And serverReply2 instead of this.serverReply2 – vaugham Jan 16 at 22:21
feedback

1 Answer

up vote 1 down vote accepted

You have a typo, it should be Messages, not Mesages

alert( serverReply2.Messages[0].Date );
link|improve this answer
Thank you for the insite – Ted pottel Jan 19 at 12:57
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.