title: Iterating through JSON object
body: <p>Since I'm fairly new to JSON and jQuery I'm struggling to iterate through an object I've sofar been able to load with the following code:</p>
  
  <pre><code>$.ajax({
      url: source,
      dataType: 'json',
      success: function(obj) {
          // Laat een succes-melding zien wanneer de data goed ingeladen is
          console.log("SUCCESS");
      },
      error: function(obj) {
          // Laat een error-melding zien wanneer de data niet goed ingeladen is
          alert("ERROR");
      },
      complete: function(obj) {
          console.log(obj);           
      }
  });
  </code></pre>
  
  <p>Unfortunately the structure of the JSON is a little bit complex for my taste, but since it's an external source (through YQL) nothing can be changed about this:</p>
  
  <pre><code>{
    "query": {
      "count": 1,
     "created": "2013-06-21T11:42:57Z",
      "lang": "en-US",
      "diagnostics": {
        "publiclyCallable": "true",
        "url": {
          "execution-start-time": "1",
          "execution-stop-time": "1868",
          "execution-time": "1867",
          "proxy": "DEFAULT",
          "content": "contentsource"
        },
        "user-time": "1868",
        "service-time": "1867",
        "build-version": "37740"
      },
      "results": {
        "viewentries": {
          "toplevelentries": "0",
          "viewentry": [
            {
              "date": "2013-06-11",
              "noteid": "A2FA",
              "position": "1",
              "siblings": "0",
              "unid": "15D7F7A15C0DAE",
              "entrydata": [
                {
                  "columnnumber": "0",
                  "name": "Datum_van_instantie",
                  "text": "2013-06-11"
                },
                {
                  "columnnumber": "1",
                  "name": "kopregel",
                  "text": "Title of newsitem 1"
                },
                {
                  "columnnumber": "2",
                  "name": "tussenkopje",
                  "text": "Introduction text of newsitem 1"
                },
                {
                  "columnnumber": "3",
                  "name": "broodtekst",
                  "text": "Content of newsitem 1"
                },
                {
                  "columnnumber": "4",
                  "name": "imagetag",
                  "text": "Image URL of newsitem 1"
                }
              ]
            },
            {
              "date": "2013-05-29",
              "noteid": "A2F6",
              "position": "2",
              "siblings": "0",
              "unid": "9237CD3822ED8DD",
              "entrydata": [
                {
                  "columnnumber": "0",
                  "name": "Datum_van_instantie",
                  "text": "2013-05-29"
                },
                {
                  "columnnumber": "1",
                  "name": "kopregel",
                  "text": "Title of newsitem 2"
                },
                {
                  "columnnumber": "2",
                  "name": "tussenkopje",
                  "text": "Introduction text of newsitem 2"
                },
                {
                  "columnnumber": "3",
                  "name": "broodtekst",
                  "text": "Content of newsitem 2"
                },
                {
                  "columnnumber": "4",
                  "name": "imagetag",
                  "text": "Image URL of newsitem 2"
                }
              ]
            }
          ]
        }
     }
    }
  }
  </code></pre>
  
  <p>The thing I'd like to accomplish is to print something similar to the following to an element in my HTML file:</p>
  
  <pre><code>Title of newsitem 1
  Title of newsitem 2
  </code></pre>
  
  <p>I'm sure from then on I am good to extract the rest of the items from the file. With the things I'm trying that makes sense to me, using an $.each loop on various obj.viewentry[0] alternatives I get an undefined error. When I try to access more specific e.g.</p>
  
  <pre><code>$.each(obj.viewentry, function(index, value) {
      console.log(this.entrydata[0]);             
  });
  </code></pre>
  
  <p>The return I get is a jQuery error, TypeError: e is undefined. Although I'm fairly sure the last code is way too 'jQuery for Dummies', other answers I've been searching for this morning haven't really given me any more clarity.</p>