title: Deserialize JSon using Newtonsoft in VB.net Collection of Data
body: <p>I have been struggling to try and deserialize this json that I have gotten from scraping Instagram. I have looked around to see how to do it but everything is in c# and converters can miss things. My code looks right to me but obviously, there is an error.</p>
  <p>This is the type of JSON I want to parse, I want to be able to get a list of usernames and there ids, now coming to think about it, it will probably be better if I made it a dictionary? Anyway here is the json test data:</p>
  <pre><code>{  
  &quot;data&quot;:{  
    &quot;user&quot;:{  
       &quot;edge_follow&quot;:{  
          &quot;count&quot;:1,
          &quot;page_info&quot;:{  
             &quot;has_next_page&quot;:false,
             &quot;end_cursor&quot;:&quot;AQAVc2MTmWj_GJRRdTbljsZIVf9JPlCXFzZhx2Io0bOJlq_qU-Oxu1Eu9u1HTB64CK8&quot;
          },
          &quot;edges&quot;:[  
             {  
                &quot;node&quot;:{  
                   &quot;id&quot;:&quot;241164259&quot;,
                   &quot;username&quot;:&quot;cherylofficial&quot;,
                   &quot;full_name&quot;:&quot;Cheryl&quot;,
                   &quot;profile_pic_url&quot;:&quot;https://scontent-lhr3-1.cdninstagram.com/t51.2885-19/s150x150/15624120_1236093059810653_247544301280559104_a.jpg&quot;,
                   &quot;is_verified&quot;:true,
                   &quot;followed_by_viewer&quot;:false,
                   &quot;requested_by_viewer&quot;:false
                }
             }
          ]
       }
    }
  },
  &quot;status&quot;:&quot;ok&quot;
  }
  </code></pre>
  <p>Classes:</p>
  <pre><code>Public Class Rootobject
      Public Property data As Data
      Public Property status As String
  End Class
  
  Public Class Data
      Public Property user As User
  End Class
  
  Public Class User
      Public Property edge_follow As Edge_Follow
  End Class
  
  Public Class Edge_Follow
      Public Property count As Integer
      Public Property page_info As Page_Info
      Public Property edges() As Edge
  End Class
  
  Public Class Page_Info
      Public Property has_next_page As Boolean
      Public Property end_cursor As String
  End Class
  
  Public Class Edge
      Public Property node As Node
  End Class
  
  Public Class Node
      Public Property id As String
      Public Property username As String
      Public Property full_name As String
      Public Property profile_pic_url As String
      Public Property is_verified As Boolean
      Public Property followed_by_viewer As Boolean
      Public Property requested_by_viewer As Boolean
  End Class
  </code></pre>
  <p>This is the code I am using to get the first id in the list:</p>
  <pre><code>Dim root As List(Of RootObject) = JsonConvert.DeserializeObject(Of List(Of RootObject))(followingJson)
              Dim id As Integer = root(0).data.user.edge_follow.edges(0).node.id
  </code></pre>
  <p>This is the error I get:</p>
  <blockquote>
  <p>Newtonsoft.Json.JsonSerializationException: 'Cannot deserialize the current JSON object (e.g. {&quot;name&quot;:&quot;value&quot;}) into type 'System.Collections.Generic.List`1[Instagram_Login.RootObject]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.</p>
  <p>To fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.</p>
  <p>Path 'data', line 1, position 8.'</p>
  </blockquote>
  <p>Any help in solving this issue is appreciated, it's just that there aren't many examples of newtonsoft in action using VB.</p>