title: Parsing a JSON array with a Dictionary.ValueCollection
body: <p>I'm struggling with the nested / valuecollection element of my Dictionary from a JSON file. From my research on stackoverflow there are examples of standard JSON files but not arrays.  I'm writing this in Unity3D and using C# so I am limited to .NET 2.0 framework and using MiniJSON to parse JSON but the bit I really don't get is to how to iterate through the items and add to a List or Dictionary of my custom class.</p>
  
  <p>Where I have got to is:</p>
  
  <p>My JSON file</p>
  
  <pre><code>{ 
      "circle": [
      {
          "density": 2, "friction": 0, "bounce": 0, 
          "filter": { "categoryBits": 1, "maskBits": 65535 },
          "shape": [   148.5, 91  ,  144.5, 104  ,  58, 148.5  ,  45, 144.5  ,  64, -0.5  ,  65, -0.5  ,  144.5, 45  ,  149.5, 63  ]
      },
      {
          "density": 2, "friction": 0, "bounce": 0, 
          "filter": { "categoryBits": 1, "maskBits": 65535 },
          "shape": [   58, 148.5  ,  144.5, 104  ,  117, 137.5  ,  104, 144.5  ,  86, 149.5  ]
      },
      {
          "density": 2, "friction": 0, "bounce": 0, 
          "filter": { "categoryBits": 1, "maskBits": 65535 },
          "shape": [   0.5, 58  ,  4.5, 45  ,  64, -0.5  ,  45, 144.5  ,  11.5, 117  ,  4.5, 104  ,  -0.5, 86  ]
      },
      {
          "density": 2, "friction": 0, "bounce": 0, 
          "filter": { "categoryBits": 1, "maskBits": 65535 },
          "shape": [   134, 27.5  ,  140.5, 37  ,  144.5, 45  ,  65, -0.5  ,  86, -0.5  ,  95, 1.5  ,  104, 4.5  ,  121, 14.5  ]
      },
      {
          "density": 2, "friction": 0, "bounce": 0, 
          "filter": { "categoryBits": 1, "maskBits": 65535 },
          "shape": [   64, -0.5  ,  4.5, 45  ,  11.5, 32  ,  32, 11.5  ,  45, 4.5  ]
      },
      {
          "density": 2, "friction": 0, "bounce": 0, 
          "filter": { "categoryBits": 1, "maskBits": 65535 },
          "shape": [   117, 137.5  ,  144.5, 104  ,  137.5, 117  ]
      },
      {
          "density": 2, "friction": 0, "bounce": 0, 
          "filter": { "categoryBits": 1, "maskBits": 65535 },
          "shape": [   11.5, 117  ,  45, 144.5  ,  32, 137.5  ]
      }
  ]
  }
  </code></pre>
  
  <p>and I am opening and parsing the root element "circles" as follows within my C# class.  This essentially gets the text file from my folder and loads to an initial Dictionary:</p>
  
  <pre><code>TextAsset jsonTextAsset = Resources.Load(_dataPath, typeof(TextAsset)) as TextAsset; 
  
  Dictionary&lt;string, object&gt; dict = jsonTextAsset.text.dictionaryFromJson();
  
  Debug.Log ("Count: " + dict.Count);
  </code></pre>
  
  <p>The count shows me I have my 1 root element.  Also if I check via the debugger I see 7 item collections, 6 of those shown in the JSON file and an empty item.</p>
  
  <p>The bit I don't get is how do I get hold of it.</p>
  
  <p>I created the following class to potentially create a custom List or Dictionary type:</p>
  
  <pre><code>public class FPObject 
  {
      public int Density { get; set; }
      public int Friction { get; set; }
      public int Bounce { get; set; }
      public int CategoryBits { get; set; }
      public int MaskBits { get; set; }
      public double[] Shape { get; set; }
  }
  </code></pre>
  
  <p>I feel I am close but I'm not experienced enough with JSON nor Dictionaries to finish this off.</p>