title: Serialize NaN values into JSON as nulls in JSON.NET
body: <p>Most Json parsers don't serialize NaN, because in Javascript, NaN is not a constant.  Json.Net, however, does serialize NaN values into NaN, which means it outputs invalid Json; attempting to deserialize this Json will fail with most parsers.  (We're deserializing in WebKit.)</p>
  
  <p>We have hacked the Json.Net code to output null values when passed NaN, but this seems like a poor solution.  Douglas Crockford (once) recommended using nulls in place of NaNs:</p>
  
  <p><a href="http://www.json.org/json.ppt" rel="noreferrer">http://www.json.org/json.ppt</a>  (Look at slide 16)</p>
  
  <p>Clearly this won't work in all cases, but it would be ok for our purposes.  We'd just rather not have to modify the source code of Json.Net.  Does anyone know how to use Json.Net to convert NaN inputs into null outputs?</p>