jsx
jsx copied to clipboard
Decimal number support, or workaround
Hello,
JSX is a nice and concise library, thank you!
I would like to use the numeric format for decimal numbers, unfortunately the number representation only works with erlang floating point values.
One solution I see would be to give a binary-string representation of the decimal number, boxed in a tuplewith a special key telling JSX to format it as a number, perhaps by ways of escaping the value in a special tuple, something like:
[
{<<"my_decimal_number">>, {'_json_number', <<"23.01">>}}
]
Of course, this also poses the problem of decoding a decimal number with JSX. Again, we could choose to box the string representation of a number so the choice to actually decode it to a float is left to the user. This process could be selected by an option...
Any ideas?
Best, Cam
i'm still working on a more user friendly way to handle custom encoding/decoding. i'll hopefully have something for you soon
Hi, May I ask you if you have made progress on this project? Thanks!
i have, but i've been busy with other projects. i'll try to get a new release out in the next week or two
@talentdeficit: did this eventually make its way to the code base? Is this still a valid concern?