title: Deserialize Nested JSON in VB.NET for conversion
body: <p>I have recently started a project using vb.net and I'm struggling to figure out how get the data for several of the items in the Mid class, o,h,l,c converted to double and loaded into an array, to eventually perform some math functions on them. Below is a small (3 candles out of 1000) sample of the JSON data I wish to work with.</p>
  
  <pre><code>{
      "instrument": "EUR_USD",
      "granularity": "M1",
      "candles": [
          {
              "complete": true,
              "volume": 18,
              "time": "2017-07-21T04:13:00.000000000Z",
              "mid": {
                  "o": "1.16281",
                  "h": "1.16284",
                  "l": "1.16274",
                  "c": "1.16281"
              }
          },
          {
              "complete": true,
              "volume": 96,
              "time": "2017-07-21T20:58:00.000000000Z",
              "mid": {
                  "o": "1.16640",
                  "h": "1.16642",
                  "l": "1.16628",
                  "c": "1.16628"
              }
          },
          {
              "complete": true,
              "volume": 32,
              "time": "2017-07-21T20:59:00.000000000Z",
              "mid": {
                  "o": "1.16628",
                  "h": "1.16652",
                  "l": "1.16628",
                  "c": "1.16641"
              }
          }
      ]
  }
  </code></pre>
  
  <p>Here is the relevant code:</p>
  
  <pre><code>Imports Newtonsoft.Json
  
  Public Class Rootobject
      Public Property instrument As String
      Public Property granularity As String
      Public Property candles() As List(Of Candle)
  End Class
  
  Public Class Candle
      Public Property complete As Boolean
      Public Property volume As Integer
      Public Property time As String
      Public Property mid As Mid
  End Class
  
  Public Class Mid
      Public Property o As String
      Public Property h As String
      Public Property l As String
      Public Property c As String
  End Class    
  
  ... 'jsonstring loaded with data here
  
  Dim obj = JsonConvert.DeserializeObject(Of Rootobject)(jsonstring)
  </code></pre>
  
  <p>I have attempted to do something similar to below with a loop only to receive errors. </p>
  
  <pre><code>Dim obj2 = obj.candles(0).mid.o 
  </code></pre>
  
  <p>I have also tried to find ways of using JObject.Parse(jsonstring) without any success. So, specifically what is the best way to get the values in the Mid class each loaded into an array for further processing?</p>
  
  <p>Thanks in advance.</p>