News for hackers. Stuff that matters.
Re:Fintech engineering mistakes by pg_1234 on Wednesday June 28, 2023 @01:50PM (#36510021)
"— If you’re using JSON to pass around monetary quantities (eg. from the frontend to the backend), put them in strings as opposed to the native number type. You never know what the serializers and deserializers across languages will do to your numbers (round them, truncate them etc.)."

I'd go a step further and prefix the strings with an ISO currency code ... to stop someone from just feeding it into their languages int to float converter and assuming that's ok. Only custom built (hopefully safe) converters will work.

Re:Fintech engineering mistakes by scrollaway on Wednesday June 28, 2023 @02:03PM (#36510212)
Ergh, I get what you're trying to prevent, but this actively breaks those custom safe parsers we build, and now you have to do some additional active parsing. Please don't do this, just set contractual expectations in your API.
Re:Fintech engineering mistakes by hannofcart on Wednesday June 28, 2023 @03:54PM (#36511707)
Politely, I think this comment may be incorrect advice.

I think correctness and precision requirements of financial transactions outweighs any devex concerns. Lots of banking and trading APIs do exactly this: pass your currency fields as strings.