- From: Dave Longley <notifications@github.com>
- Date: Fri, 18 Dec 2015 18:09:42 -0800
- To: w3c/webpayments <webpayments@noreply.github.com>
- Message-ID: <w3c/webpayments/issues/40/165935808@github.com>
> I'm not sure how this could be true. Do different JSON parsers interpret integers differently? If they are large enough, sure. node.js/Chrome/Firefox: ```js console.log(JSON.parse('{"key": 123456789123456789}').key); ``` Result: ``` 123456789123456780 ``` Python: ```py import json print(json.loads('{"key": 123456789123456789}')['key']) ``` Result: ``` 123456789123456789 ``` PHP: ```php <?php echo json_decode('{"key": 123456789123456789}')->key; ?> ``` Result: ``` 123456789123456789 ``` Increase the number enough and Python will work just fine but PHP with start throwing integer overflow errors. I didn't test any other parsers. I think we should serialize these numbers in a way that is guaranteed not to lose any precision. We could declare "X bits should be enough for any currency" or we could use a string and avoid that (potentially incorrect) assumption. > Developers using ISO8583 have managed for some decades as I say. Will they be the only developers using this new API? --- Reply to this email directly or view it on GitHub: https://github.com/w3c/webpayments/issues/40#issuecomment-165935808
Received on Saturday, 19 December 2015 02:10:12 UTC