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

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

[Octave-bug-tracker] [bug #63622] jsonencode breaks down on (nested) emp


From: Philip Nienhuis
Subject: [Octave-bug-tracker] [bug #63622] jsonencode breaks down on (nested) empty struct arrays
Date: Fri, 6 Jan 2023 13:39:34 -0500 (EST)

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

As a workaround, or alternative, there are toJSON and fromJSOM in the io
package which seem to do the right thing:

>> x.y = struct('z', {})
x =
  scalar structure containing the fields:
    y =
      0x0 struct array containing the fields:
        z

>> jsonencode (x)
ans = {"y"}
>> jsondecode (jsonencode (x))
error: jsondecode: parse error at offset 5: Missing a colon after a name of
object member.

>> toJSON (x)
ans = {"y":{}}
>> fromJSON (toJSON (x))
ans =
  scalar structure containing the fields:
    y =
      scalar structure containing the fields:

>> jsondecode (toJSON (x))
ans =
  scalar structure containing the fields:
    y =
      scalar structure containing the fields:





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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