title: Accessing stringified JSON objects
body: <p>As another user in my other <a href="https://stackoverflow.com/questions/18360935/accessing-json-data-from-a-url/18361396?noredirect=1#comment26961310_18361396">thread</a> suggested to post another question here in regards to explaining how to access JSON Objects. The code I am using is:</p>
  
  <p></p>
  
  <pre><code>&lt;script src="http://code.jquery.com/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  $(function () {
      $.getJSON(
         "https://api.guildwars2.com/v1/wvw/matches.json",
          function (data) {
              $("#reply").html(JSON.stringify(data));
              // or work with the data here, already in object format
          });
  });
  &lt;/script&gt;
  </code></pre>
  
  <p>What I am trying to do with <a href="https://api.guildwars2.com/v1/wvw/matches.json" rel="nofollow noreferrer">the JSON code</a>, is to search through for a specified <code>world_id</code> and return the <code>match_id</code>. I'm very new to JavaScript so I'm not too sure how to do it, and how to access the stringified data which the code above gives me.</p>
  
  <p>The way I figured how to do this, is to create an array and store each object in it, then loop through and check for a matching id like,</p>
  
  <pre><code>if(obj[i].red_world_id == 'xxxx' || obj[i].blue_world_id == 'xxxx' || obj[i].green_world_id == 'xxxx') {
      return obj[i].wvw_match_id;
  }
  </code></pre>
  
  <p>My only problem is I'm not sure how to set an array as the JSON data.</p>