title: Using JsonConvert.DeserializeObject to dynamically choose class
body: <p>So I am making an api call and I need to use JsonConvert.DeserializeObject to convert it to a class. The Json structure comes back as the following</p>
  <pre><code>{
      &quot;fcResponse&quot;: {
          &quot;responseData&quot;: {
              &quot;fcRequest&quot;: {
                  &quot;mail&quot;: &quot;Emails&quot;,
                  &quot;outlookMail&quot;: &quot;Outlook Emails&quot;,
                   (etc.)
              }
          }
      }
  }
  </code></pre>
  <p>The problem is that the values that come back inside &quot;fcRequest&quot; varies based on the parameters I am sending.</p>
  <p>The class structure is as follows so far</p>
  <pre><code>    public class GetSubModulesResponse : BaseResponse
      {
          [JsonProperty(&quot;fcResponse&quot;)]
          public SubModuleResponse Response { get; set; }
      }
  
      public class SubModuleResponse
      {
          [JsonProperty(&quot;responseData&quot;)]
          public SubModuleData Data { get; set; }
      }
  
      public class SubModuleData
      {
          [JsonProperty(&quot;fcRequest&quot;)]
          public SubModuleFIMRequest RequestFIM { get; set; }
  
          [JsonProperty(&quot;fcRequest&quot;)]
          public SubModuleFSRequest RequestFS { get; set; }
      }
  </code></pre>
  <p>And this is the basic call structure</p>
  <pre><code>GetSubModulesResponse subModuleResponse = new GetSubModulesResponse();
  var response = SubmitAPICall();
  subModuleResponse = JsonConvert.DeserializeObject&lt;GetSubModulesResponse&gt;(response);
  </code></pre>
  <p>Now I know I obviously can't have the same JsonProperty on both RequestFIM and RequestFS, but what I'm trying to do is somehow find a way to switch which one of those two properties I should use based on a variable.</p>