title: SignalR list of object undefined
body: <p>I am trying to display on the console a list of object But it doesn't show the objects...</p>
  
  <p><a href="https://i.stack.imgur.com/Ej4gj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ej4gj.png" alt="enter image description here"></a></p>
  
  <p>Here is the javascript I use to display the object received from the server :</p>
  
  <pre><code>connection.on("ReceiveLog", function (chatMessages) {
  
  console.log(chatMessages);
  
  for (var item in chatMessages) {
  
      // work with key and value
      var encodedMsg = item.User + " says " + item.Message;
          var li = document.createElement("li");
          li.textContent = encodedMsg;
          document.getElementById("messagesList").appendChild(li);
  } });
  </code></pre>
  
  <p>The server is sending a list of ChatMessage. Here is the ChatMessage class :</p>
  
  <pre><code>public class ChatMessage
  {
      string User { get; set; }
      string Message { get; set; }
  
      public ChatMessage(string user, string message)
      {
          this.User = user;
          this.Message = message;
      }
  }
  </code></pre>
  
  <p>Why are my objects completely broken ? When I break the code on the server side, it really sends the list correctly. The problem seems to be from the javascript or maybe I need to serialize from the server side ?</p>