guregu / null

reasonable handling of nullable values
BSD 2-Clause "Simplified" License
1.86k stars 238 forks source link

Fixed marshalling of NaN, json marshalled as 'null' #25

Closed igm closed 6 years ago

igm commented 6 years ago

JSON does not support NaN, which are valid values of float64 in Go so NaN needs to be marshalled as null.

guregu commented 6 years ago

Hello, thanks for bringing this to my attention. Instead of marshaling silently to null, I've decided to act the same as the standard library and return an error (see: 26f8e1321cf66395a76e4671e6e67f4cc37f84cf). This fix has been included in the latest release.