title: Class for deserializing dynamic JSON data
body: <p>I'm trying to build the class structure for deserializing some dynamic/changing JSON data but after many attempts I'm not able to figure out a way to create the class declarations to pull this data in using System.Runtime.Serialization.Json.</p>
  
  <p>Here's the portion of the JSON that's causing me grief:  </p>
  
  <pre><code>"expertPicks": [
      {
          "user_id": 280,
          "name": "Andrew Brandt",
          "picks": {
              "1336": {
                  "st": 1,
                  "s": 1,
                  "t": "GB",
                  "r": "win"
              },
              "1337": {
                  "st": 1,
                  "s": 7,
                  "t": "TEN",
                  "r": "win"
              },
              "1338": {
                  "st": 1,
                  "s": 3,
                  "t": "BAL",
                  "r": "win"
              },
              "1339": {
                  "st": 1,
                  "s": 4,
                  "t": "BUF",
                  "r": "win"
              },
              "1340": {
                  "st": 1,
                  "s": 8,
                  "t": "PHI",
                  "r": "win"
              },
              "1341": {
                  "st": 1,
                  "s": 6,
                  "t": "LAR",
                  "r": "win"
              },
              "1344": {
                  "st": 1,
                  "s": 2,
                  "t": "MIN",
                  "r": "win"
              },
              "1347": {
                  "st": 1,
                  "s": 5,
                  "t": "KC",
                  "r": "win"
              },
              "1351": {
                  "st": 1,
                  "s": 9,
                  "t": "SEA",
                  "r": "win"
              },
              "1352": {
                  "st": 1,
                  "s": 10,
                  "t": "LAC",
                  "r": "win"
              },
              "1353": {
                  "st": 1,
                  "s": 11,
                  "t": "AZ",
                  "r": "tie"
              },
              "1354": {
                  "st": 1,
                  "s": 12,
                  "t": "DAL",
                  "r": "win"
              },
              "1355": {
                  "st": 1,
                  "s": 13,
                  "t": "TB",
                  "r": "lose"
              },
              "1356": {
                  "st": 1,
                  "s": 14,
                  "t": "NE",
                  "r": "win"
              },
              "1357": {
                  "st": 1,
                  "s": 15,
                  "t": "NO",
                  "r": "win"
              },
              "1358": {
                  "st": 1,
                  "s": 16,
                  "t": "OAK",
                  "r": "win"
              }
          }
      },
  </code></pre>
  
  <p>It's the unique ID's in the "picks" data that's causing me grief (i.e. 1336, 1337, 1338, etc.).  I can create a class structure like this one below to pull them in and that works fine.  My problem is that the IDs will change every week, and it doesn't make sense to create a GamesPick class with every possible number they might use through the year.</p>
  
  <p>Is there any way at all that I can create/declare a class (or classes) to dynamically pull this data in using System.Runtime.Serialization.Json, or am I going to have to parse it manually using the JSon.NET library?</p>
  
  <pre><code>  &lt;DataContract()&gt; _
      Public Class ExpertPick
          &lt;DataMember(name:="user_id")&gt; _
          Public Property ExpertID As Integer
          &lt;DataMember(name:="name")&gt; _
          Public Property ExpertName As String
          &lt;DataMember(name:="picks")&gt; _
          Public Property Picks As GamePicks
      End Class
     &lt;DataContract()&gt; _
      Public Class GamePicks
          &lt;DataMember(Name:="1336")&gt; _
          Public Property Game1336 As GamePick
          &lt;DataMember(Name:="1337")&gt; _
          Public Property Game1337 As GamePick
          &lt;DataMember(Name:="1338")&gt; _
          Public Property Game1338 As GamePick
          &lt;DataMember(Name:="1339")&gt; _
          Public Property Game1339 As GamePick
          &lt;DataMember(Name:="1340")&gt; _
          Public Property Game1340 As GamePick
          &lt;DataMember(Name:="1341")&gt; _
          Public Property Game1341 As GamePick
          &lt;DataMember(Name:="1344")&gt; _
          Public Property Game1344 As GamePick
          &lt;DataMember(Name:="1347")&gt; _
          Public Property Game1347 As GamePick
          &lt;DataMember(Name:="1351")&gt; _
          Public Property Game1351 As GamePick
          &lt;DataMember(Name:="1352")&gt; _
          Public Property Game1352 As GamePick
          &lt;DataMember(Name:="1353")&gt; _
          Public Property Game1353 As GamePick
          &lt;DataMember(Name:="1354")&gt; _
          Public Property Game1354 As GamePick
          &lt;DataMember(Name:="1355")&gt; _
          Public Property Game1355 As GamePick
          &lt;DataMember(Name:="1356")&gt; _
          Public Property Game1356 As GamePick
          &lt;DataMember(Name:="1357")&gt; _
          Public Property Game1357 As GamePick
          &lt;DataMember(Name:="1358")&gt; _
          Public Property Game1358 As GamePick
      End Class
  </code></pre>
  
  <p><strong>Edit:</strong>
  I've updated the classes as suggested (here):</p>
  
  <pre><code>    &lt;DataContract()&gt; _
      Public Class ExpertPick
          &lt;DataMember(name:="user_id")&gt; _
          Public Property ExpertID As Integer
          &lt;DataMember(name:="name")&gt; _
          Public Property ExpertName As String
          &lt;DataMember(name:="picks")&gt; _
          Public Property Picks As Dictionary(Of String, GamePick)
      End Class
      &lt;DataContract()&gt; _
      Public Class GamePick
          &lt;DataMember(Name:="t")&gt; _
          Public Property Team As String
          &lt;DataMember(Name:="st")&gt; _
          Public Property st As Integer
          &lt;DataMember(Name:="s")&gt; _
          Public Property s As Integer
          &lt;DataMember(Name:="r")&gt; _
          Public Property r As String
      End Class
  </code></pre>
  
  <p>But when I deserialize the JSON I get no picks for any of the experts:</p>
  
  <p><a href="https://i.stack.imgur.com/gS4vW.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gS4vW.jpg" alt="enter image description here"></a></p>