Think of the Precision! Decimals.

1 min read

As part of the FHIR specification when using JSON, it has a “Dragon call-out” when using numbers that’s worth looking at:

JSON representation of primitive elements

If you’re dealing with values where precision matters (money, science, health…,etc.), please make sure you’re accounting for the loss of precision that is likely if you’re using common JSON parsers. Numbers are often converted to floating point values. Decimal data types aren’t included in every programming language so you may have to find a library to get it right.

Depending on the scenario, it could be a minor inconvenience to a customer/user, but it could be much much worse. Go check that you’re doing the right thing. I’ll be here waiting.