title: Deserializing JSON with numbers as keys
body: <p><strong>EDIT: I figured out how to get each key, now the problem is looping through each collection. Solution at bottom!</strong></p>
  
  <p>I'm trying to parse a JSON payload that has the following format:</p>
  
  <pre><code>{
      "version": "1.1", 
      "0": {
                "artist": "Artist 1",
                "title": "Title 1"
           },
      "1": {
                "artist": "Artist 2",
                "title": "Title 2"
           },
      ...
      "29": {
                "artist": "Artist 30",
                "title": "Title 30"
           }
  }
  </code></pre>
  
  <p>I don't need the <code>version</code> key, so I'm ignoring it while coding my classes. This is what I have so far:</p>
  
  <pre><code>public class Song
  {
      public string artist { get; set; }
      public string title { get; set; }
  }
  </code></pre>
  
  <p>I've checked around StackOverflow and I've seen people using <code>Dictionary&lt;int, string&gt;</code> for similar problems, but it doesn't look like people have each JSON object in the root. I'm using JSON.net to parse everything.</p>
  
  <p>In PHP, I could easily use <code>json_decode()</code> and walk through the array and extract all the info I need, but I'm stumped by C#.</p>
  
  <p><strong>EDIT: Solution begins below.</strong></p>
  
  <p>I looked at the JSON.net documentation and they used dictionaries, so I tried using nested dictionaries, and it seems to work!</p>
  
  <pre><code>Dictionary&lt;int, Dictionary&lt;string, string&gt;&gt; song = JsonConvert.DeserializeObject&lt;Dictionary&lt;int, Dictionary&lt;string, string&gt;&gt;&gt;(json);
  </code></pre>
  
  <p>And I can access the <code>artist</code> and <code>title</code> properties via:</p>
  
  <pre><code>song[0]["artist"]
  song[0]["title"]
  </code></pre>
  
  <p>respectively.</p>
  
  <p>This eliminates the need for pre-built classes. Now I'm having trouble looping through each set of data collection (e.g. artist and title info for song[1], song[2], song[3], ..., song[n]).</p>