Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Option to decode fractional numbers to decimal #15

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ymv
Copy link

@ymv ymv commented Dec 16, 2013

New decode option number_format - when set to decimal, numbers with exponent or fraction are decoded to erlang-decimal compatible tuple. For original behaviour omit this option or set it to float

{1,12,5} = jsonx:decode(<<"-1.2e6">>, [{number_format, decimal}]).

JSON non-integer numerals as decoded to {Sign, Value, Scale} tuple
instead of floating-point value, if {number_format, decimal} option
is given to jsonx:decode/2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant