Poor Error consistency for conversion to LabVIEW types

Issue #65 resolved
James Powell repo owner created an issue

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?)

See also issues #7, #47, #51

Comments (8)

  1. James Powell 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.

  2. James Powell 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

  3. James Powell reporter

    Fixed failure with Fixed Point and null (made gve error).

    Fixed issue where null convert to Cluster gives no error.

  4. James Powell 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).

  5. Log in to comment