Jump to content

JSON ignoring single variant in a cluster


Voklaif

Recommended Posts

Hi,

I found today the JKI JSON tool, which looks great, but I've encountered a problem.

When I try to "wrap" some data around a new object, with a cluster with a single variant it ignores it.

Please see screenshot for clearance:

image.thumb.png.7fdb367cf3dd029a3472ece10bf94979.png

The output is the same. I expect the left string to have the "bridge_data" in it.

Is it a bug or am I not using it correctly?

Thank you

Link to comment
Share on other sites

This looks like a bug.

(Note: I've filed a bug report in our issue tracker here: https://github.com/JKISoftware/JKI-JSON-Serialization/issues/34)

I see the same thing as you. The "bridge_data" is missing, here, when it's the only element in the cluster.

image.png

 

However, if I add another element next to the variant (so it's not the only element in the cluster) then I see "bridge_data" in the JSON string.

image.png

 

JSON Test ignoring single variant in a cluster.vi.zip

Link to comment
Share on other sites

@Voklaif We dug into it and it turns out to be a LabVIEW bug. The solution is for the user (you) put a To Variant function before the call to Flatten to JSON String, since the bug seems to be inside the coercion dot (and the To Variant function doesn't seem to have that problem).

image.png 

Note: here's the bug (and fix) reduced to a very simple example (example VI also attached for anyone who wants to play with it)...

Coerce to Variant Fail (LV2019).vi

image.png

image.png

 

 

  • Like 1
Link to comment
Share on other sites

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.

Loading...
×
×
  • Create New...

Important Information

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