title: Reading Data from a Javascript Array returns 'undefined'
body: <p>I'm trying to read the attribubute named "MediaURL" from my Javascript array object. The image below shows an expanded view of my array:</p>
  
  <p><a href="https://i.stack.imgur.com/BWNym.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BWNym.png" alt="enter image description here"></a></p>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>Uncaught TypeError: Cannot read property 'MediaURL' of undefined</p>
  </blockquote>
  
  <p>Here's my code:</p>
  
  <pre><code>    PageMethods.LoadFollowingTab(useremail, onSuccess, onFailure);
  
        function onSuccess(val) {
  
            var obj = JSON.parse(val); //this is the array object. I have logged it in console and it's not empty
            obj.forEach(function (value) {
            img1.src = value.Activities[0].MediaURL;
            //I am setting the MediaURL of the first element of the Array as the image source
         });
   }
  </code></pre>
  
  <p>This returns that error. Am I reading the array wrong? What do you think is the problem?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I pass the result to json using JavaScriptSerializer in the C# Code Behind in ASP.NET:</p>
  
  <pre><code>[WebMethod]
   public static string LoadFollowingTab(string email)
   {
         string json = "";
  
              List&lt;String&gt; following = PBC.LoadFollowingTab(email);
  
              var jsonSerialiser = new JavaScriptSerializer();
              json = jsonSerialiser.Serialize(following);
  
              return json;
   }
  </code></pre>
  
  <p>Sadly the resulting string is long and I can't post it here. I think the array view I have posted will suffice? :)</p>