4 ms·
I'm also working with Brazilian instant payments schema, aka PIX. We've simply created a mapping layer to convert all ISO messaging to json. Internally all our
by rafaelturk 6y ago
I'm also working with Brazilian instant payments schema, aka PIX. We've simply created a mapping layer to convert all ISO messaging to json.
Internally all our logic runs on json. It works because at the end of the day, payments only need a few fields to work: Source, Destination, Amount.
- apta 6y agoQuite scary to run financial transactions using an untyped format.
- zo1 6y agoEverything is JSON these days, unfortunately.
- novok 6y agoYou can apply schemas and force integers although. You also have typed serialization formats such as protobuf.
- djbebs 6y agoYou'd be surprised just what kind of stuff goes through JSON to be parsed by unreliable Javascript engines 9ver software that doesn't correctly implement the JSON standard >.<
- jerkstate 6y ago>json I hope you aren't using floats for cents!
- mimsee 6y agoHonest question. Would it differ if one used floats in json rather than floats in XML?
- vincnetas 6y agoNo it would not, but you could use decimals in xml. Edit: looks like there is no float in xml.
- bedatadriven 6y agoNor are there floats in JSON! Json numbers are stored in decimal with varying lengths.
- treve 6y agoYes, but almost any standard JSON package will map a number with decimals to their internal float. While alternative parsers exists (javascript has LosslessJSON for example), they're a pain to use. Using strings for floats only has a tiny overhead, but it allows users to use standard JSON parsers and it signals a good practice. If you use JSON numbers to serialize money, you create a situation where the path with the least friction is the incorrect one.
- masklinn 6y ago> While alternative parsers exists (javascript has LosslessJSON for example), they're a pain to use. FWIW in Python that's as uncomplicated as json.loads('1.1', parse_float=decimal.Decimal) though of course it helps tremendously that `decimal` is part of the stdlib.
- faichai 6y agoNumbers in JSON are stored as strings. So as long as encoder/decoder is storing them in suitable format e.g BigDecimal no precision need be lost.
- microcolonel 6y agoThat may be technically true, but decoding sad encoding JSON without reading numbers as doubles is a special feature.
- masklinn 6y ago
- sandGorgon 6y agowhat do you guys think of https://mojaloop.io/ https://mojaloop.io/ vs ISO?
- lelc 6y agoEven the BCB itself has this ISO20022-xml to simpler-schema-in-json mapping layer.