Voklaif Posted February 12, 2020 Report Share Posted February 12, 2020 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: 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 Quote Link to comment Share on other sites More sharing options...
Jim Kring Posted February 13, 2020 Report Share Posted February 13, 2020 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. 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. JSON Test ignoring single variant in a cluster.vi.zip Quote Link to comment Share on other sites More sharing options...
Jim Kring Posted February 14, 2020 Report Share Posted February 14, 2020 @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). 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 1 Quote Link to comment Share on other sites More sharing options...
Voklaif Posted February 16, 2020 Author Report Share Posted February 16, 2020 This works. Thanks for the quick reply and fix. Quote Link to comment Share on other sites More sharing options...
Jim Kring Posted February 16, 2020 Report Share Posted February 16, 2020 12 hours ago, Voklaif said: This works. Thanks for the quick reply and fix. Glad that worked for you. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.