Any way to make json.net ignore dictionary entries where value is null?

Mar 27, 2013 at 3:57 PM
Edited Mar 27, 2013 at 3:58 PM
I am using web api with asp.net. I won't show the c# class that I am serializing. I do know about [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] . I am wondering if json.net could be made to leave out array entries where the value is null, for example the LinkedIn and SomeSite in the json below:

{"PrincipalType":"OAuthAggregator.AnonPrinicpal","APIsAndTokens":{"LinkedIn":null,"SomeSite":null},"CookieValue":"No auth cookie found.","Id":"","LoggedIn":false,"TimeStamp":634999941386132768}