parsing JSONItem

I’ve never used a JSONItem before but am trying to parse the following JSON string:

{“shapePoints”:[39.740112,-104.984856,39.799438,-105.72361,39.6403,-106.373596],“elevationProfile”:[{“distance”:0,“height”:1616},{“distance”:63.55,“height”:3911},{“distance”:121.96,“height”:2501}],“info”:{“copyright”:{“text”:“© 2013 MapQuest, Inc.”,“imageUrl”:“http://api.mqcdn.com/res/mqlogo.gif",“imageAltText”:"© 2013 MapQuest, Inc.”},“statuscode”:0,“messages”:[]}}

Following the example in the manual, I can extra the “elevationProfile” JSONItem from this string but when I try to extract the distance height pairs I keep getting a JSONItem is an array exception. I gather this is because of the multiple pairs within the square brackets. Any suggestions for how to extract the distances and heights and read them into two arrays, dist and elevation which are dimensioned as doubles?

Thanks

elevationProfile is an array of JSONItems within the main JSONItem. This code will pop up a message box for each distance/height pair:

  Dim js As New JSONItem(Data) ' assume Data is the raw JSON string
  Dim elevationProfile As JSONItem = js.Value("elevationProfile") ' Get the elevationProfile array
  For i As Integer = 0 To elevationProfile.Count - 1 ' loop over elevationProfile
    Dim elevationitem As JSONItem = elevationProfile.Child(i)
   
    ' grab the elevationProfile item's data
    Dim distance, height As Double
    distance = elevationitem.Value("distance")
    height = elevationitem.Value("height")
    
    MsgBox("Item #" + Str(i) + " Distance: " + Str(distance) + " Height: " + Str(height))
  Next

Thanks, Adam. That’s exactly what I needed. I screwed up the child(i) part before.