Fixed a problem generaitng JSON with NaN value

There was a problem where the JSON generator would allow NaN value of
NSDecimalNumber to be written into JSON. This was due to the fact that
NSDecimalNumber is a subclass of NSNumber, and stringValue of NaN value
is represented as "NaN", which is invalid in JSON. JSON data with NaN
value can cause many parsers to fail (including YAJL), as this is not
supported by JSON.