JSON doesn't support NaN or infinity, so most JS implementations emit null for NaN, +Inf, -Inf. In Node:
> JSON.stringify({nan: 0/0, inf: 1/0, neginf:-1/0})
'{"nan":null,"inf":null,"neginf":null}'
I'm not sure if throwing an exception is better or worse.