title: How to determine if a JSON response will bind to a model
body: <p>We have a 3rd party service provider that based on a action a notification Webhook is sent to our webhook url using JSON. Due to the fact that i can only provide 1 webhook url all notifications need to funnel to the 1 url. I need to determine which model to deserialze to.</p>
  
  <p>I understand how to deserialize JSON string into an object model.</p>
  
  <p>Here is an example of what is first sent to our webhook</p>
  
  <pre><code>{
      "providerAccount": {
          "id": XXXXXX,
          "aggregationSource": "USER",
          "refreshInfo": {
              "statusCode": 801,
              "statusMessage": "ADD_IN_PROGRESS",
              "status": "IN_PROGRESS",
              "additionalStatus": "LOGIN_IN_PROGRESS"
          }
      }
  }
  </code></pre>
  
  <p>and then after another 10 or so seconds another JSON webhook comes in.</p>
  
  <pre><code>{
      "event": {
          "info": "REFRESH.INTERIM_PROGRESS",
          "loginName": "XXXXXX",
          "data": {
              "providerAccount": {
                  "id": XXXXXX,
                  "providerId": XXXXXX,
                  "isManual": false,
                  "createdDate": "2017-12-08",
                  "aggregationSource": "USER",
                  "refreshInfo": {
                      "status": "IN_PROGRESS",
                      "additionalStatus": "LOGIN_SUCCESS",
                      "statusCode": 0,
                      "statusMessage": "OK",
                      "nextRefreshScheduled": "0001-01-01T00:00:00",
                      "lastRefreshed": "0001-01-01T00:00:00",
                      "lastRefreshAttempt": "0001-01-01T00:00:00"
                  },
                  "loginForm": null
              }
          }
      }
  }
  </code></pre>
  
  <p>As you can see they would be 2 separate model objects which i need to deserialize.</p>
  
  <p>I find that checking for null on the first model to the second model seems wrong and can be achieved in a different way.</p>
  
  <p>There are another 3 different JSON strings that come through the same webhook. and to check for if model is null, if this model is null etc. then move to next seems wrong.</p>