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

How to force to dispaly 0 after decimal? #30

Closed
adishri22 opened this issue Jun 5, 2017 · 1 comment
Closed

How to force to dispaly 0 after decimal? #30

adishri22 opened this issue Jun 5, 2017 · 1 comment

Comments

@adishri22
Copy link

I have response which is in an xml file. When I am using this parser and converting json for some attributes which has value like '2.0' or '5.0' it is giving me simply '2' and '5'. How I can force it to give me '2.0' and '5.0'.

@ghost
Copy link

ghost commented Jul 11, 2017

This is a side effect of the grokAttr and grokText attributes being set to true. The type checking code in this library uses the javascript parseFloat() method which truncates trailing zeros. For your specific use case, try setting the grokAttr and/or grokText attributes to false. This will leave the values untouched as well as disable smart truthyness.

If this doesn't work for you, let me know and I will see what I can do.

@ghost ghost closed this as completed Jul 21, 2017
This issue was closed.
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

No branches or pull requests

1 participant