octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #59135] jsondecode converts logical arrays to


From: Rik
Subject: [Octave-bug-tracker] [bug #59135] jsondecode converts logical arrays to numeric arrays
Date: Fri, 18 Sep 2020 16:11:41 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36

URL:
  <https://savannah.gnu.org/bugs/?59135>

                 Summary: jsondecode converts logical arrays to numeric arrays
                 Project: GNU Octave
            Submitted by: rik5
            Submitted on: Fri 18 Sep 2020 01:11:39 PM PDT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Matlab Compatibility
                  Status: Confirmed
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
                 Release: dev
         Discussion Lock: Any
        Operating System: Any

    _______________________________________________________

Details:

The following is from a BIST test for jsondecode:


 json = '[[true, true], [false, true]]';
 exp  = logical ([1, 1; 0, 1]);
 obs  = jsondecode (json);
 assert (isa (obs, 'logical'));
 assert (isequal (obs, exp));
!!!!! test failed
assert (isa (obs, 'logical')) failed


The decoded matrix type should be logical, but instead is of class "double". 
This does not happen for logical scalars.


octave:1> isa (jsondecode ('true'), "logical")
ans = 1







    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?59135>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]