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

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

[Octave-bug-tracker] [bug #63199] [feature request] add a function to in


From: Yu Hongbo
Subject: [Octave-bug-tracker] [bug #63199] [feature request] add a function to inverse eval() function
Date: Tue, 11 Oct 2022 02:39:35 -0400 (EDT)

Follow-up Comment #2, bug #63199 (project octave):

Your idea is great(use the existing functions to avoid adding a new function),
but there're some problems about the two functions.

The jsonencode() and jsondecode() function have undocumented transformation,
unsupported transformation, unexpected transformation and array reshaping
situations. So in this way Octave cannot transform every kind of variants to
string.

Since the jsonencode() and jsondecode() function have Matlab versions, Octave
should better add a new expression() function to leave the two functions
compatible with Matlab.

Some bugs(if Matlab does so, we can do nothing but realize a new function) are
as below:

# bug 1: unsupported transformation on jsonencode() function
>> jsonencode(@source)
error: jsonencode: unsupported type

# bug 2: unexpected transformation on jsondecode() function
>> jsondecode('[{},{}]')
ans =

  2x1 struct array containing the fields:


>> jsondecode('[[{}],{}]')
ans =
{
  [1,1] =

    scalar structure containing the fields:


  [2,1] =

    scalar structure containing the fields:


}

>> jsondecode('[[{}],[{}]]')
ans =

  2x1 struct array containing the fields:

# bug 3: undocumented transformation on jsondecode() function
>> jsondecode(jsonencode(NA))
ans = [](0x0)
# the document doesn't contain "null, outside an array"



    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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