title: Does the business logic for deserializing a JsonPayload have to match?
body: <p>I am currently attempting to deserialize a Json Payload that has been fired from a webhook URL on an MVC application, but I do not know if the business logic provided has to match exactly to prevent any null values.</p>
  
  <p>Basically the Json Payload contains way to much useless information that I do not what to display.  This is a brief preview of what the Payload looks like:</p>
  
  <pre><code>"webhookEvent":"jira:issue_updated",
  "user":{
  "self":"http://gtlserver1:8080/rest/api/2/user?username=codonoghue",
  "name":"codonoghue",
  "issue":{
  "id":"41948",
  "self":"http://gtlserver1:8080/rest/api/2/issue/41948",
  "key":"OP-155",
  "fields":{
  "summary":"Test cc recipient",
  "progress":{
  "progress":0,
  "total":0}, ....
  </code></pre>
  
  <p>I only want to display information about the issue and the other information is just white noise to me and don't want to use it.  Now do I have to create classes only for the issue details etc like this:</p>
  
  <pre><code>Public Class jiraIssue
      Public Property id As String
      Public Property key As String
      Public Property fields As jiraFields
  End Class
  </code></pre>
  
  <p>Or do I have to make sure to provide sufficient business logic about the <strong>User</strong> class just to make sure that it will be received correctly?  I also know that using <strong>Json2csharp.com</strong> the classes that can be made are <strong>user</strong>, <strong>issue</strong>, <strong>fields</strong>, <strong>progress</strong> as well as the overall <strong>RootObject</strong>, so I also want to know is do these classes need to contain the exact same matching variables as the JsonPayload, e.g. I don't want progress to have the variable total.  </p>
  
  <p>When using Json2csharp that in every class they contain an ID variable with the property as string and I would like to know if this is needed in the classes to be able to display the information or can I not use it as it is also irrelevant.</p>
  
  <p>The main thing that I want to deserialize is the <strong>RootObject</strong>, which contains a <strong>webhookEvent (string)</strong> an <strong>issue</strong> (which links to issue class, which links to fields class which links to all relevant information), comment which links to a comment class.  I want to deserialize this so would this be correct?</p>
  
  <pre><code>Public Class Rootobject
      Public Property webhookEvent As String
      Public Property issue As Issue
      Public Property comment As Comment2
      Public Property timestamp As Long
  End Class
  
  Public Class Issue
      Public Property key As String
      Public Property fields As Fields
  End Class
  
  Public Class Fields
      Public Property issueType as IssueType
      Public Property summary As String
      Public Property summary As String
  End Class
  
  
  
  Dim Issue As RootObject = New System.Web.Script.Serialization.JavaScriptSerializer().Deserialize(Of RootObject)(json)
  
  For Each item As var In Issue.issue
      Console.WriteLine("WebhookEvent: {0}, issue: {1}", item.WebhookEvent, item.issue)
  Next
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>It seems that the problems that I was having was due to the JsonPayload itself, the business logic did not affect.  There were issues with the incompatible characters, some fields were null and could not be and a few others as well.  </p>