title: Valid JSON file but bad structure? (Json.NET)
body: <p>This is my first time using JSON. I have to read objects from a JSON file which I have no input over(structure/format). I have been using <a href="http://json2csharp.com/" rel="nofollow">http://json2csharp.com/</a> to understand what objects I could get from it.
  <strong>Based on the examples below, is the structure in this file bad?</strong> 
  I have changed the actual field names in the example, structure otherwise the same as the file I have to read from. There are hundreds of these objects(FRUITS) and will be many more.
  Should I use RegExp to get a better JSON structure before parsing the JSON file?</p>
  
  <p>Original file:</p>
  
  <pre><code>{
  "FRUITS": {
      "BANANA": {
          "category"      : "FRUITS",
          "fruit_type"    : "Peelable",
          "description"   : "Yellow soft fruit",
          "identifier"    : "BANANA",
          "attributes": [ {
                  "description"   : "hardness",
                  "value"         : 3
              }, {
                  "description"   : "smell",
                  "strength"      : 1,
                  "max_value"     : 10
              }, {
                  "argument"      : "PRESS",
                  "description"   : "Press fruit",
                  "strength"      : 2
          } ],
          "physical_type": "yellow"
      },
      "APPLE": {
          "category"      : "FRUITS",
          "fruit_type"    : "Peelable",
          "description"   : "Red hard fruit",
          "identifier"    : "APPLE",
          "attributes"    : [ {
                  "description"   : "hardness",
                  "value"         : 10
              }, {
                  "description"   : "smell",
                  "strength"      : 1,
                  "max_value"     : 10
              }, {
                  "argument"      : "PRESS",
                  "description"   : "Press fruit",
                  "strength"      : 2
          } ],
          "physical_type" : "red"
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>Classes generated are:</p>
  
  <pre><code>        public class Attribute
      {
           public string description { get; set; }
           public int value { get; set; }
           public int? strength { get; set; }
           public int? max_value { get; set; }
           public string argument { get; set; }
      }
  
      public class BANANA
      {
           public string category { get; set; }
           public string fruit_type { get; set; }
           public string description { get; set; }
           public string identifier { get; set; }
           public List&lt;Attribute&gt; attributes { get; set; }
           public string physical_type { get; set; }
      }
  
      public class Attribute2
      {
           public string description { get; set; }
           public int value { get; set; }
           public int? strength { get; set; }
           public int? max_value { get; set; }
           public string argument { get; set; }
      }
  
      public class APPLE
      {
           public string category { get; set; }
           public string fruit_type { get; set; }
           public string description { get; set; }
           public string identifier { get; set; }
           public List&lt;Attribute2&gt; attributes { get; set; }
           public string physical_type { get; set; }
      }
  
      public class FRUITS
      {
           public BANANA BANANA { get; set; }
           public APPLE APPLE { get; set; }
      }
  
      public class RootObject
      {
           public FRUITS FRUITS { get; set; }
      }
  </code></pre>
  
  <p>If I change it a little bit to:</p>
  
  <pre><code>{
  "FRUITS": [{        
          "category"      : "FRUITS",
          "fruit_type"    : "Peelable",
          "description"   : "Yellow soft fruit",
          "identifier"    : "BANANA",
          "attributes": [ {
                  "description"   : "hardness",
                  "value"         : 3
              }, {
                  "description"   : "smell",
                  "strength"      : 1,
                  "max_value"     : 10
              }, {
                  "argument"      : "PRESS",
                  "description"   : "Press fruit",
                  "strength"      : 2
          } ],
          "physical_type": "yellow"
      },{
          "category"      : "FRUITS",
          "fruit_type"    : "Peelable",
          "description"   : "Red hard fruit",
          "identifier"    : "APPLE",
          "attributes"    : [ {
                  "description"   : "hardness",
                  "value"         : 10
              }, {
                  "description"   : "smell",
                  "strength"      : 1,
                  "max_value"     : 10
              }, {
                  "argument"      : "PRESS",
                  "description"   : "Press fruit",
                  "strength"      : 2
              } ],
              "physical_type" : "red"
      }]  
  </code></pre>
  
  <p>}</p>
  
  <p>I get the following classes:</p>
  
  <pre><code>        public class Attribute
      {
           public string description { get; set; }
           public int value { get; set; }
           public int? strength { get; set; }
           public int? max_value { get; set; }
           public string argument { get; set; }
      }
  
      public class FRUIT
      {
           public string category { get; set; }
           public string fruit_type { get; set; }
           public string description { get; set; }
           public string identifier { get; set; }
           public List&lt;Attribute&gt; attributes { get; set; }
           public string physical_type { get; set; }
      }
  
      public class RootObject
      {
           public List&lt;FRUIT&gt; FRUITS { get; set; }
      }
  </code></pre>