title: Deserializing a JSON with variable name/value pairs into object in C#
body: <p>I am using C# .NET 4.0 to parse a JSON into a custom object. I am using JavaScriptSerializer.Deserialize to map it to a class that I wrote. Problem is, the JSON's name/value pairs are not static and vary depending on the argument isChain, as seen in this JSON fragment (better link at bottom):</p>
  
  <pre><code>{
     "STATE_WALK_LEFT":{
        "isChain":"1",
        "x":"1"
     },
     "STATE_WALK_LEFT_0":{
        "x":"0"
     },
     "STATE_WALK_LEFT_1":{
        "x":"40"
     },
     "STATE_WALK_LEFT_2":{
        "x":"80"
     },
     "STATE_WALK_RIGHT":{
        "isChain":"0"
     },
     "STATE_RUN_LEFT":{
        "isChain":"0"
     }
  }
  </code></pre>
  
  <p>The chains can have anywhere from _STATE_0 to _STATE_25 entries in the chains. Is there some way to store this data so I don't have to write 12*26 empty classes like so:</p>
  
  <pre><code>public StateWalkLeft0 STATE_WALK_LEFT { get; set; }
  public StateWalkLeft0 STATE_WALK_LEFT_0 { get; set; }
  public StateWalkLeft1 STATE_WALK_LEFT_1 { get; set; }
  public StateWalkLeft2 STATE_WALK_LEFT_2 { get; set; }
  public StateWalkLeft3 STATE_WALK_LEFT_3 { get; set; }
  </code></pre>
  
  <p>Is there a library or some other way I could use to partially parse <em>only</em> the STATE_0, STATE_1, etc fields? Could you maybe suggest a way to add these recently added JSON pairs?</p>
  
  <p><b>Edited to clarify</b>:
  To get an idea of what I'm working with, here is the Class derived from the JSONs:</p>
  
  <p><a href="http://pastebin.com/Jmi1p6FF" rel="noreferrer">Check out my full Class to get an idea of what the JSONs contain</a></p>
  
  <p>Basically, I just need a way to store these recently implemented chains in this class somehow for processing. All of those classes/properties are generated from these JSONs.</p>