jsx icon indicating copy to clipboard operation
jsx copied to clipboard

Decimal number support, or workaround

Open tuscland opened this issue 10 years ago • 4 comments

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

tuscland avatar Oct 07 '14 13:10 tuscland

i'm still working on a more user friendly way to handle custom encoding/decoding. i'll hopefully have something for you soon

talentdeficit avatar Oct 23 '14 19:10 talentdeficit

Hi, May I ask you if you have made progress on this project? Thanks!

tuscland avatar Sep 04 '15 10:09 tuscland

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 avatar Sep 14 '15 19:09 talentdeficit

@talentdeficit: did this eventually make its way to the code base? Is this still a valid concern?

paulo-ferraz-oliveira avatar Sep 12 '20 01:09 paulo-ferraz-oliveira