3 ms·
JSON (and CSV for that matter) both use commas as list/column separators. So formatting floats using periods as the separator is much more compatible with these
by CydeWeys 7y ago
JSON (and CSV for that matter) both use commas as list/column separators. So formatting floats using periods as the separator is much more compatible with these formats. Never mind that programming languages format their floats in this manner too.
Let's not kid ourselves, the comma representation does not play well with programming languages or common data formats, and for that reason shouldn't be used except at the very top level of the UI for formatting purposes when displaying for certain locales. You're needlessly making things a lot harder for yourself if you attempt otherwise.
- jeroenhd 7y agoMost of the CSVs I've encountered used the semicolon as a field separator, probably for exactly this reason, even ones from American sources. JSON has a standard format for writing numbers, which happens to be the American one, and I don't know what other data formats are sensitive to the comma. I don't store floats in the users locale and I don't think anyone should, just like dates should be stored in UTC (timestamps, preferably) instead of in any local date format. However, many programmers seem to forget that if you don't specify a locale, the system will choose one for you and its probably the one the user set up while installing their system, just like what would happen with any date or time. I'm not going to change the way I write numbers because some American programmer thinks it's too annoying to bother and neither are my customers. Localisation is important to remember because if you don't, you're going to be burned by it at some point. This is just another gentle reminder about that.