title: Remove nesting/arrays when deserializing JSON using JSON.Net
body: <p>I'm running into some issues trying to deserialize some JSON from an API I'm working with. For some reason the API likes to wrap the data in extra layers and arrays when it isn't necessary.</p>
  
  <pre><code>{
      "CustomData": [
          {
              "Wrapper": [
                  {
                      "OptionalDataSet1": [
                          {
                              "ItemA": "Basic string"
                          },
                          {
                              "ItemB": "Another basic string"
                          }
                      ]
                  }
              ]
          }
      ]
  }
  </code></pre>
  
  <p>Using json2csharp I've gotten classes that work for the above example.</p>
  
  <pre><code>public class OptionalDataSet1
  {
      public string ItemA { get; set; }
      public string ItemB { get; set; }
  }
  
  public class Wrapper
  {
      public List&lt;OptionalDataSet1&gt; OptionalDataSet1 { get; set; }
  }
  
  public class CustomData
  {
      public List&lt;Wrapper&gt; Wrapper { get; set; }
  }
  
  public class RootObject
  {
      public List&lt;CustomData&gt; CustomData { get; set; }
  }
  </code></pre>
  
  <p>The issue I'm having is the "Wrapper" class is unneeded according to the API. It's always there but will be the only item in Custom Data. Furthermore, there will only ever be a single instance of "OptionalDataSet1" inside of the Wrapper. There are other "OptionalDataSets", but again, they will be unique per request.</p>
  
  <p>Finally, the Wrapper deserializes TWO objects for "OptionalDataSet1", the first with ItemA's value, the second with ItemBs. There are other data sets that can have upwards of forty items available to them, I don't want to scan through forty instances of an object to find which one has the single data attribute I'm trying to find.</p>
  
  <p>Should I massage the JSON string I'm receiving from the API before sending it off to be deserialized by removing the "Wrapper" and converting the List&lt;> properties to singular instances, or is there another method I'm missing using JSON.Net to produce something like</p>
  
  <pre><code>RootObject.CustomData.OptionalDataSet1.ItemB
  </code></pre>
  
  <p>Instead of</p>
  
  <pre><code>RootObject.CustomData[0].Wrapper[0].OptionalDataSet[1].ItemB
  </code></pre>