Jump to content

LAVA JSON API


PBD_ctrl

Recommended Posts

This is my first post but I have been browsing LAVA for years!  I couldn't figure out how to post this within the repository forums so I decided to throw it up here.

 

I am using the JSON LabVIEW 1.1 API in a large project and just came across an issue.  The attached VI shows the problem but what it boils down to is that doubles get truncated to 6 decimal places.  It is being truncated because of the Format Into String function's "format string".  Was this done on purpose?  I know how to make the change that I am looking for but I would like to see it get worked into the package's source.

 

Thanks,

     -Pat 

 

 

post-49634-0-80618100-1387406691.png

Build Basic JSON.vi

Link to comment

Googling other JSON implementations, I think we should change the format to the following:

 

SGL: %#.6g (equivalent to the %#g we have now)

DBL: %#.14g

EXT: as many digits as the LabVIEW functions to make text from numbers give us, which seems to be only %#.17g from my limited testing

 

This is deliberately less than maximum precision, so as not displaying decimal numbers like 0.1 as 0.10000000000000001.

Link to comment

If LabVIEW limits the string representation of EXT numbers you may be able to extract more digits by rounding to some precision, generating the first set of digits, then generating the second group based off the difference. Ugly for sure, but if that's the only way...

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.