3 ms·
First thing that I check before using a JSON parser library is that if it lets me to get the number as a string and let me do my own conversion. Libraries that
by Cloudef 3y ago
First thing that I check before using a JSON parser library is that if it lets me to get the number as a string and let me do my own conversion. Libraries that try to treat the number as double or bring in a large bigint/decimal library gets usually pass from me.
- speedgoose 3y agoIf you need a specific exotic JSON parser to parse the numbers you have correctly, I would argue that you should serialise them as strings and not as numbers. That's what prometheus is doing for example. https://prometheus.io/docs/prometheus/latest/querying/api/ https://prometheus.io/docs/prometheus/latest/querying/api/
- Cloudef 3y agoThat only works if you are the one who serializes the json in the first place.