You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed that some numeric values are changed after formatting the JSON.
To reproduce:
1.Input the following text and select it {"number":-1722.1864265316147}
2.Format text using "Plugins-JSON Viewer-Format JSON"
3.The result is { "number": -1722.1864265316149 }
Hi, the issue does not appear to be totally fixed to me.
With v.1.32, input {"number":-1722.1864265316147}
is correctly formatted to { "number": -1722.1864265316147 }
However, adding a 9 at the end: {"number":-1722.18642653161479}
gives the incorrect rounding { "number": -1722.1864265316149 }
This is related to a precision issue while converting string to double in the JSON parsing library. Other way is to parse the number to string. But, then it starts to show numbers inside quotes after formatting. I am trying to find out what could be done here. Let me know if anyone has a solution.
yet another precision error case: lat long coordinates in plain text: [12.148681171238422,42.835353759876654]
After "JSON Format": [12.148681171238423, 42.835353759876657]
Is it really necessary for a formatter to convert numeric string values to anything? My (maybe naive) idea would be that a formatter should just insert some newlines and whitespace at the correct locations and be done with it. But if it's really unavoidable, would it maybe be possible to write the original string value, rather than the parsed numeric value?
Activity
kapilratnani commentedon Oct 14, 2018
Thanks for reporting. Check release 1.32 in releases section.
GabrieleDiCorato commentedon Oct 15, 2018
Hi, the issue does not appear to be totally fixed to me.
With v.1.32, input
{"number":-1722.1864265316147}
is correctly formatted to
{
"number": -1722.1864265316147
}
However, adding a 9 at the end:
{"number":-1722.18642653161479}
gives the incorrect rounding
{
"number": -1722.1864265316149
}
kapilratnani commentedon Nov 18, 2018
This is related to a precision issue while converting string to double in the JSON parsing library. Other way is to parse the number to string. But, then it starts to show numbers inside quotes after formatting. I am trying to find out what could be done here. Let me know if anyone has a solution.
AlexanderNobi commentedon Jan 29, 2020
Another example is
{
"Id": 100000000302052988.0
}
After "JSON Format" the value is 100000000302052990.
radiothom commentedon Jul 28, 2020
yet another precision error case: lat long coordinates in plain text: [12.148681171238422,42.835353759876654]
After "JSON Format": [12.148681171238423, 42.835353759876657]
bveldkamp commentedon Sep 24, 2021
This is an annoying issue. Scientific values are also messed up, for example:
becomes
Is it really necessary for a formatter to convert numeric string values to anything? My (maybe naive) idea would be that a formatter should just insert some newlines and whitespace at the correct locations and be done with it. But if it's really unavoidable, would it maybe be possible to write the original string value, rather than the parsed numeric value?
user21760 commentedon Nov 10, 2021
Potentially related to #78 (issue with parsing)