title: JSON.NET Deserialization with VB.NET/ASP.NET - Frustrating
body: <p>I have a feeling i'm making just a small oversight here and I think a second (or third) pair of eyes could help work it out. Here is what I have done:</p>
  
  <ol>
  <li>Made a request to a webservice</li>
  <li>Received the JSON response from that webservice</li>
  <li>Read that JSON into a string</li>
  </ol>
  
  <p>The string successfully contains the JSON output. However, this is where things get difficult. I've created a public class into which I want to cast my deserialized JSON. However, when I try to cast the JSON string into a class (using JSON.NET) I receive the following error.</p>
  
  <pre><code>Cannot deserialize the current JSON array (e.g. [1,2,3]) into type  m      'Sandbox.youtube+Item' because the type requires a JSON object (e.g. {"name":"value"}) to deserialize correctly.
  
  To fix this error either change the JSON to a JSON object (e.g. {"name":"value"}) or change the deserialized type to an array or a type that implements a collection interface (e.g. ICollection, IList) like List&lt;T&gt; that can be deserialized from a JSON array. JsonArrayAttribute can also be added to the type to force it to deserialize from a JSON array.
  </code></pre>
  
  <p>The JSON looks something like this:</p>
  
  <pre><code>{
  "kind": "youtube#searchListResponse",
  "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/AgytE2CN3Aj3J6OFJ5iDqg8-Hbw\"",
  "pageInfo": {
   "totalResults": 1000000,
   "resultsPerPage": 50
       },
    "nextPageToken": "CDIQAA",
    "items": [
     {
    "kind": "youtube#searchResult",
     "etag": "\"Fn7tolrWrLXf7uknBpwCU9OfMA8/mQk0CDCRDq-8Xy5YSW9FLLA7B3g\"",
     "id": {
  "kind": "youtube#video",
  "videoId": "BJ2q017EL08"
  }
   }
  </code></pre>
  
  <p>(I may have missed a few brackets when copying / pasting across)</p>
  
  <p>My public class looks like this:</p>
  
  <pre><code>Public Class Rootobject
  
      Public Property kind As String
      Public Property etag As String
      Public Property pageInfo As Pageinfo
      Public Property nextPageToken As String
      Public Property items() As Item
  End Class
  
  Public Class Pageinfo
      Public Property totalResults As Integer
      Public Property resultsPerPage As Integer
  End Class
  
  Public Class Item
      Public Property kind As String
      Public Property etag As String
      Public Property id As Idprop
  End Class
  
  Public Class Idprop
      Public Property kind As String
      Public Property videoId As String
  End Class
  </code></pre>
  
  <p>and I attempt to cast like this:</p>
  
  <pre><code>Dim ent As Rootobject = TryCast(Json.JsonConvert.DeserializeObject(Of Rootobject)(webresponse), Rootobject)
  </code></pre>
  
  <p><strong>Any ideas are REALLY appreciated!</strong></p>
  
  <p>All the best,
  Jordan</p>