title: How to ignore default values while serializing json with Newtonsoft.Json
body: <p>I'm using <code>Newtonsoft.Json.JsonConvert</code> to serialize a <code>Textbox</code> (WinForms) into json and I want the serialization to skip properties with default values or empty arrays.</p>
  
  <p>I'v tried to use <code>NullValueHandling = NullValueHandling.Ignore</code> in <code>JsonSerializerSettings</code> but is doesn't seem to affect anything.</p>
  
  <p>Here is the full code sample (simplified):</p>
  
  <pre><code>JsonSerializerSettings settings = new JsonSerializerSettings()
                  {
                      Formatting = Formatting.None,
                      DefaultValueHandling = DefaultValueHandling.Ignore,
                      NullValueHandling = NullValueHandling.Ignore,
                      ReferenceLoopHandling = ReferenceLoopHandling.Ignore,
                      ObjectCreationHandling = ObjectCreationHandling.Replace,
                      PreserveReferencesHandling = PreserveReferencesHandling.None,
                      ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
                  };
  
      string json = JsonConvert.SerializeObject(textbox, settings);
  </code></pre>
  
  <p>Any ideas ?</p>