Convert a JSON string into a native Octave object.
fromJSON especially strives to convert numerical JSON arrays into Octave vector, matrix or ND array. Special provisions are made to recognize +/-Inf, NaN and complex numbers, which are conventionally not permited in JSON strings.
Input arguments:
Leave sarray set to TRUE for fast parsing of numerical JSON arrays and objects. Octave vectors, matrices, ND arrays and struct arrays are returned as much as possible, otherwise returned as a combination of vectors/matrices and cell arrays.
Set sarray to FALSE if, with fast parsing, output does not match expections, particularly if str mainly comprises JSON objects/arrays with strings. All JSON member arrays are returned as (nested) Octave cell arrays.
Output:
Special numbers:
The specification for JSON does not allow +/-Inf, NaN or complex numbers; nevertheless, provisions are made here to enable these important numbers:
e.g. '{"re":3,"im":1}' => 3 + 1i '[1,{"re":3,"im":1}]' => [ 1 + 0i, 3 + 1i ]
See also: toJSON.
Package: io