bugGNU Octave - Bugs: bug #59198, jsonencode converts N-dimensional...

 
 

bug #59198: jsonencode converts N-dimensional logical arrays to N-dimensional numeric arrays

Submitter:  Rik <rik5>
Submitted:  Mon 28 Sep 2020 03:35:17 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Matlab Compatibility
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 03 Oct 2020 02:08:46 PM UTC, comment #3: 

Indeed it does.  I checked the patch in here: http://hg.savannah.gnu.org/hgweb/octave/rev/97d8ef9b7348.  I made a small change which was to use "false" instead of "0" when initializing a bool type variable.  The compiler doesn't care, but it is clearer to programmers coming later that the variable is boolean and takes only two values.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Thu 01 Oct 2020 09:35:32 PM UTC, comment #2: 
Abdallah Khaled Elshamy <abdallah_elshamy>
Mon 28 Sep 2020 03:45:07 PM UTC, comment #1: 

I added a BIST test for this bug in this changeset: http://hg.savannah.gnu.org/hgweb/octave/rev/191538bdae3f.

Rik <rik5>
Group administrator
Mon 28 Sep 2020 03:35:17 PM UTC, original submission:  

The following code is translated to a N-dimensional logical array in Matlab, but not in Octave.


t = true (2,2,2);
t(1,1,2) = false;
json = jsonencode (t)


You can tell because the JSON text contains "true" and "false" rather than "1" and "0".


Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by abdallah_elshamy (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  • -email is unavailable- added by rik5
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2020-10-03 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed
    2020-09-28 rik5 Carbon-Copy- Added abdallah_elshamy

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code