title: Deserializing JSON into generic where collection property name changes based on type
body: <p>I'm working on parsing some API responses using Newtonsoft.Json, and they seem to have a pretty regular structure, except for an array property name that changes based on the return type. A couple response examples (with fake/empty data):</p>
  
  <p><strong>Customer:</strong></p>
  
  <pre><code>{
    "success": true,
    "message": "Records Retrieved Successfully",
    "data": {
      "total_count": "1",
      "customer": [
        {
          "id": "1234",
          "accountId": "220",
          "email": "json.voorhees@lycos.com",
          "name": "JSON Voorhees",
          "company": "Test Company",
          "customFieldsValues": [
            {
              "value": "Some Guy",
              "field": {
                "id": "69",
                "name": "SalespersonID",
                "label": "Account Manager"
              }
            }
          ]
        }
      ]
    }
  }
  </code></pre>
  
  <p><strong>Invoice:</strong></p>
  
  <pre><code>{
    "success": true,
    "message": "Records Retrieved Successfully",
    "data": {
      "total_count": "0",
      "invoice": []
    }
  }
  </code></pre>
  
  <p>You'll notice in the first one, the property name of the array is "customer", and in the second, it's "invoice" (we don't have any invoices, so I don't know exactly what the structure of that object will be yet).</p>
  
  <p>My end goal is to deserialize into a class structure something like this:</p>
  
  <pre><code>public class Response {
      [JsonProperty("success")]
      public bool Success { get; set; }
      [JsonProperty("message")]
      public string Message { get; set; }
  }
  
  public class Response&lt;T&gt; : Response {
      public List&lt;T&gt; Data { get; set; }
  }
  </code></pre>
  
  <p>Since that's not doable directly with a simple <code>DeserializeObject()</code> call (because the array of business objects is contained within that intermediate "data" property), this seems like it's a bit closer to what's needed, but the problem is the moving target for the <code>[JsonProperty()]</code> attribute:</p>
  
  <pre><code>public class Response {
      [JsonProperty("success")]
      public bool Success { get; set; }
      [JsonProperty("message")]
      public string Message { get; set; }
  }
  
  public class Response&lt;T&gt; : Response {
      public ResponseData Data { get; set; }
  }
  
  public class ResponseData&lt;T&gt; {
      [JsonProperty("total_count")]
      public int TotalCount { get; set; }
  
      [JsonProperty("???")] //Moving target
      public List&lt;T&gt; Data { get; set; }
  }
  </code></pre>
  
  <p>What's the sanest way to pull this off?</p>