03-11-2013 05:15 AM
Hi there,
first of all - thanks for this great and easy to use toolkit.
While starting to implement it I've stumbled over this problem.
On german OS the decimal place is a comma not a point. So the resulting JSON object looks like this:
{"cmd":4,000000,"key":[],"value":[]}
but should look like this to be a valid JSON object:
{"cmd":4.000000,"key":[],"value":[]}
I've attached the 2 modified files. Now converting to and from JSON works.
UPDATE:
I've attached an updated version of the JSON Tree Base Type to String.vi
this update correctly converts double, single and integer values.
Now there are no 0s at the end of a (decimal) number. Integer values are now integer values without a dot or 0s
situation before:
{"i32":3.000000,"sgl":2.500000}
now:
{"i32":3,"sgl":2.5}
The converted string is now smaller in size and better readable 🙂
03-11-2013 05:55 AM
see the first post for the update - if one already downloaded the files, redownload the JSON... vi
03-11-2013 07:12 AM
Hi BastiFantasti!
I like the idea of changing the format string to %#g as that is a pretty quick change and looks good. Also thanks for the localization catch! I'll add both changes to the next release.
03-11-2013 07:27 AM
Hi MilanR
ok and thanks for the reply. The string needs to be %.;%#g otherwise using a dot as decimal place isn't forced.
Best regards,
Basti
03-11-2013 08:49 AM
Will do! Thanks :]
07-24-2013 07:03 AM
Hi, thanks for the really nice JSON library.
With respect to the formatting of numeric values, a short question arised within my project.
One result of the automatic formating (%.;%#g) is, that larger decimal numbers (UNIX timestamps in my project - 1374666515 as an example) are formatted in scientific notation (1.374667E+9), losing information.
Is there a way to encode such decimals as numeric values, since encoding within a string value seems a bit strange for a is-always-a-number value?
Sorry, if this functionality is already present and I simply missed it.
Thanks!
07-24-2013 08:56 AM
Hi Locutio,
you're right - large numbers are converted in scientific notation.
This issue can be fixed with using: %.;%#f as format string
can you please try if this fixes your issue?
Regards,
Bastian
07-24-2013 09:16 AM
Hi Bastian,
thanks for your response. The format string %.;%#f does indeed produce the correct output for me.