Why Nostr? What is Njump?
2025-02-19 12:44:51

Nicolas Martyanoff on Nostr: Go's encoding/json parser is fundamentally broken: it assumes that all numbers are ...

Go's encoding/json parser is fundamentally broken: it assumes that all numbers are floats (a very common mistake about JSON), meaning that if you decode without a concrete type and re-encode, integers become floats (e.g. {"a":42} -> {"a":42.0}).

The UseNumber() option helps with that, but now you have to deal with a custom json.Number type in all data processing functions.

All they had to do was to check for a '.' character in the token during parsing to identify the type of the number.
Author Public Key
npub1dkg70vzk4vvfsc5cup9gkfu2tcrs5unysl7npfvegf78nkuswr5skh54dt