akheron/jansson — pull request #158 by apoelstra (2014-01-27 00:15:46+00:00)
Title: Decimals

There is a popular JSON-using program out there (Bitcoin) which uses JSON reals for decimal values. Specifically, there are always exactly 8 digits of precision in its values, all of which need to be preserved. This PR supports that usecase by adding a JSON_READ_DECIMALS flag to json_loads(), which causes all numbers to be parsed as the new json_decimal type (rather than integers or reals).

Internally, json_decimals are just an integer alongside a decimal-position value which represents the number of digits after the decimal point.