Poor Error consistency for conversion to LabVIEW types
JSONtext has poor consistency of what happens when there is a mismatch between the JSON and the LabVIEW type.
Examples (see “Null treatment.vi”):
- null → integer: error 4012842
- true → integer: error 4012841
- null → string: error 4012841
- any scalar → cluster: no error, default
- any scalar → array: error 402840, empty array (even if default not empty)
Related issues:
- should null-->”” if a string?
- should a scalar be equivalent to a one-element array?
Also, some users want the option of treating null as default, without error (should this option override null-->NaN?)
Comments (8)
-
reporter -
reporter Current codes are:
<nierror code="402840">
JSONtext: Input JSON has wrong type for requested operation<nierror code="402841">
JSONtext: Parsing Error. Invalid JSON formating (example: missing coma or quote) or unexpected type (example: found an Array when an Object was required)<nierror code="402842">
JSONtext: Error<nierror code="402843">
JSONtext: LabVIEW Type not implemented with JSONtext library.
So really we should be using 402840 mostly.
-
reporter Actually, 402840 is used for things like trying to insert an a non-object, so perhaps a new error code:
402844: unable to convert JSON Value to supplied LabVIEW Type
-
reporter Added new error, and better message for all scaler types.
-
reporter Fixed failure with Fixed Point and null (made gve error).
Fixed issue where null convert to Cluster gives no error.
-
reporter - changed status to resolved
Added to Test Cases
-
reporter Note: had to extensively rework the to Cluster bit of teh code (needed it). Now clearer how it handles Cluster to Array (Ragged Array, or unnamed cluster).
-
reporter - Log in to comment
Also enums: