Skip to content

Instantly share code, notes, and snippets.

@AshV
Last active February 5, 2019 10:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshV/1464f4855e8a7a2524431e00b284a0f8 to your computer and use it in GitHub Desktop.
Save AshV/1464f4855e8a7a2524431e00b284a0f8 to your computer and use it in GitHub Desktop.
Remove null properties while serializing JSON using Newtonsoft.Json
using Newtonsoft.Json;
JsonConvert.SerializeObject(
<your Object to be serialized>,
Newtonsoft.Json.Formatting.None,
new JsonSerializerSettings
{
NullValueHandling = NullValueHandling.Ignore
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment