title: JSON object inside an array inside json object: Accessing specific elements
body: <p>I'm looking at an ajax response and it contains a large json object, which contains an array, which contains json data like this:</p>
  
  <pre><code>"chat": {
      "chat": [
           {
          "chat_type": 0,
          "chat_id": 445473683,
          "chat_name": "system",
          etc,
          etc,
          "chat_talk": "Chat+messages+here"
          },
          {
          //Another chat message
          }
  
      ]
  }
  </code></pre>
  
  <p>There are dozens of json entries inside the chat array, which only seems to have the 1 element. There are a few "chat_types" 0, 1, and 2. Now, what I want to do is select only chat entries that are of type 2 and do NOT have system as the "chat_name".</p>
  
  <p>But the whole object in an array in an object confuses the heck out of me. How would I accomplish this?</p>
  
  <p>EDIT: Code so far -</p>
  
  <pre><code>function modChat (clickEvent) {
  var chatHistory = [];
  var extraData = '{"planet_id":"6_300_6","item_config_version":"' + getChatTimeStamp() + '","count":20,"tick":"-1","language":"en"}';
  
  //$("#chatBody").html(extraData);
  
  runRequest(extraData, gameDataURL, function(response) {
  
      var results = [];
      var chats = JSON.stringify(response.chat.chat);
      for (var i = 0; i &lt; chats.length; i++) {
          if (chats[i].chat_type == 2 &amp;&amp; chats[i].chat_name != "system") {
              results.push(chats[i]);
          }
      }
  
      $("#chatBody").val(chats);
  
  });//End postRequest
  
  }
  </code></pre>