title: Looping through JSON Array using ASPJSON
body: <p>Thanks to advice from here (<a href="https://stackoverflow.com/questions/30782144/looping-through-json-using-aspjson?noredirect=1#comment49615942_30782144">Looping through JSON using ASPJSON</a>) and here (<a href="https://stackoverflow.com/questions/30538292/asp-json-object-not-a-collection">ASP JSON: Object not a collection</a>), I am starting with a JSON array in Classic ASP:</p>
  
  <pre><code>{"markers": [{
    "event":"hard_bounce",
    "msg":{
       "ts":1365109999,
       "subject":"This an example webhook message",
       "email":"example.webhook@mandrillapp.com",
       "sender":"example.sender@mandrillapp.com",
       "tags":[
          "webhook-example"
       ],
       "state":"bounced",
       "metadata":{
          "user_id":111
       },
       "_id":"exampleaaaaaaaaaaaaaaaaaaaaaaaaa",
       "_version":"exampleaaaaaaaaaaaaaaa",
       "bounce_description":"bad_mailbox",
       "bgtools_code":10,
       "diag":"smtp;550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces."
    },
    "_id":"exampleaaaaaaaaaaaaaaaaaaaaaaaaa",
    "ts":1433940242
  },
  {
    "event":"hard_bounce",
    "msg":{
       "ts":1365109999,
       "subject":"This an example webhook message",
       "email":"example.webhook@mandrillapp.com",
       "sender":"example.sender@mandrillapp.com",
       "tags":[
          "webhook-example"
       ],
       "state":"bounced",
       "metadata":{
          "user_id":111
       },
       "_id":"exampleaaaaaaaaaaaaaaaaaaaaaaaaa1",
       "_version":"exampleaaaaaaaaaaaaaaa",
       "bounce_description":"bad_mailbox",
       "bgtools_code":10,
       "diag":"smtp;550 5.1.1 The email account that you tried to reach does not exist. Please try double-checking the recipient's email address for typos or unnecessary spaces."
    },
    "_id":"exampleaaaaaaaaaaaaaaaaaaaaaaaaa1",
    "ts":1433940242
  }]
  }
  </code></pre>
  
  <p>I am using Classic ASP and ASPJSON (<a href="http://www.aspjson.com/" rel="nofollow noreferrer">http://www.aspjson.com/</a>).</p>
  
  <p>I can access the "_id" and "ts" values from the loop via:</p>
  
  <pre><code>Set oJSON = New aspJSON
  
  'read the local JSON data
  oJSON.loadJSON(str2)
  
  For Each thingy In oJSON.data("markers")
  
      Set this = oJSON.data("markers").item(thingy)
      Response.Write _
      this.item("_id") &amp; ": " &amp; _
      this.item("ts") &amp; "&lt;br&gt;"
  
  Next
  </code></pre>
  
  <p>However, I am stuck trying to get at the data one level down, in the "msg" section.</p>
  
  <p>I did try:</p>
  
  <pre><code>For Each thingy In oJSON.data("markers")
  
      Set this = oJSON.data("markers").item(thingy)
      Response.Write _
      this.item("_id") &amp; ": " &amp; _
      this.item("ts") &amp; "&lt;br&gt;"
  
      For Each thingy2 In oJSON.data("msg")
          Set this2 = oJSON.data("this2").item(thingy2)
          Response.Write _
          this2.item("subject") &amp; ": " &amp; _
          this2.item("diag") &amp; "&lt;br&gt;"
      Next
  
  Next
  </code></pre>
  
  <p>But get this error:</p>
  
  <blockquote>
    <p>Description: Object not a collection : .</p>
  </blockquote>
  
  <p>Relating to this line:</p>
  
  <p>For Each thingy2 In oJSON.data("msg")</p>
  
  <p>I guess I am doing something silly, but I am stuck on this one and can't work out how to access that data.</p>