title: Deserializing JSON string to Object with json.net
body: <p>I'm building a small application that pulls statistics from an API I have no control over.
  The JSON string looks like this:</p>
  
  <pre><code>{
      "weapons":
          [
              {
                  "aek":
                      {
                          "name":"AEK-971 Vintovka",
                          "kills":47,
                          "shots_fired":5406,
                          "shots_hit":858
                      },
                  "xm8":
                      {
                          "name":"XM8 Prototype",
                          "kills":133,
                          "shots_fired":10170,
                          "shots_hit":1790
                      },
              }
          ]
  }
  </code></pre>
  
  <p>and my objects are set up as follows:</p>
  
  <pre><code>class WeapsCollection
  {
      public WeaponList[] Weapons { get; set; }
  }
  
  class WeaponList
  {
      public WeaponDetails AEK { get; set; }
      public WeaponDetails XM8 { get; set; }
  }
  
  class WeaponDetails
  {
      public string Name { get; set; }
      public int Kills { get; set; }
      public int Shots_Fired { get; set; }
      public int Shots_Hit { get; set; }
  }
  </code></pre>
  
  <p>I don't have any problems deserializing the string the way it is set up now, i.e. I can do:</p>
  
  <pre><code>WeapsCollection weps = JsonConvert.DeserializeObject&lt;WeapsCollection&gt;(json);
  Console.WriteLine(weps.Weapons.First().AEK.Name.ToString());
  Console.ReadLine();
  </code></pre>
  
  <p>This outputs <code>AEK-971 Vintovka</code></p>
  
  <p>Fine... but I don't want the different weapons as separate properties. I want to be able to enumerate and do a foreach on each weapon or something like this:</p>
  
  <pre><code>Console.WriteLine(weapons.Where(w =&gt; w.Kills &gt; 30).Name.ToString());
  </code></pre>
  
  <p>Any tips how to achieve this?</p>
  
  <p>The list of actual weapons is 60+ but I've been thinking about doing a string.Replace ("[weaponName]", "weapon") on the JSON data before deserializing it, but I cannot get it to work either.</p>
  
  <p>I'd appreciate any tips.</p>