The string NaN is not valid JSON. Yet Unmarshaling it does not fail on this input. In particular, [1, NaN, 2] in my experimentation unmarshals to []float64{1, 2}, meaning not only is invalid JSON accepted, but the resulting value doesn't even match what you might expect!
The string
NaN
is not valid JSON. Yet Unmarshaling it does not fail on this input. In particular,[1, NaN, 2]
in my experimentation unmarshals to[]float64{1, 2}
, meaning not only is invalid JSON accepted, but the resulting value doesn't even match what you might expect!