flori/json — pull request #145 by shyouhei (2012-08-06 08:41:33+00:00)
Title: JSON.dump vs. #to_json inconsistency

Look,

zsh% ruby -rjson -e'p [0.0/0.0].to_json'
-e:1:in `to_json': 778: NaN not allowed in JSON (JSON::GeneratorError)
from -e:1:in `

'

it raises error but,

zsh% ruby -rjson -e'JSON.dump([0.0/0.0], STDOUT)'
[NaN]

this one doesn't.

I'm not against the ability of dumping `NaN`s but this is quite confusing. Please let them behave the same.