title: Ignore Null Values When Serializing JSON
body: <p>Is it possible to serialize an object to JSON but only those properties with data?</p>
  
  <p>For example:</p>
  
  <pre><code>public class Employee
  {
     [JsonProperty(PropertyName = "name")]
     public string Name { get; set; }
  
     [JsonProperty(PropertyName = "id")]
     public int EmployeeId { get; set; }
  
     [JsonProperty(PropertyName = "supervisor")]
     public string Supervisor { get; set; }
  }
  
  var employee = new Employee { Name = "John Doe", EmployeeId = 5, Supervisor = "Jane Smith" };
  
  var boss = new Employee { Name = "Jane Smith", EmployeeId = 1 };
  </code></pre>
  
  <p>The employee object will be serialized as:</p>
  
  <pre><code> { "id":"5", "name":"John Doe", "supervisor":"Jane Smith" }
  </code></pre>
  
  <p>The boss object will be serialized as:</p>
  
  <pre><code> { "id":"1", "name":"Jane Smith" }
  </code></pre>
  
  <p>Thanks!</p>