From Saturday, Nov 23rd 7:00 PM CST - Sunday, Nov 24th 7:45 AM CST, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

JDP Science Tools

cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: "From JSON Text.vim" fails for 2D boolean arrays

The issue is inside "JSON text to Variant.vi". Here's a minimal example:

fabric_1-1712209734031.png

BUG - JSON text to Variant.png

 

There are explicit cases to handle most common types including numerics and strings, but there is no explicit case for booleans

fabric_0-1712208841937.png

 

Therefore, booleans revert to the Default case:

fabric_2-1712209997318.png

 

The bug arises because a 1D array of variants is coerced back to a variant at the output of the error structure (see the red arrow in the image above). When that wire is auto-indexed at the output of the next FOR loop we end up with a "1D array of 1D arrays of variants", rather than a "2D array of variants" as we should. (These are not the same thing!)

 

The solution for the Default case is simple: Add a "build array" to the No Error case to avoid the coercion. Then we correctly get a 2D array of variants at the output.

fabric_3-1712210327875.png

 

An additional improvement is to include a specific handler for boolean arrays, as per the integer case. It requires implementations for 1D, 2D and 3D. This is much more performant than the Default handler!

fabric_4-1712210541540.png

 

Message 1 of 1
(249 Views)