Returns a valid JSON string that will describe object; the string will be in a compact form (no spaces or line breaks). It will map simple octave values this way: function handles: string with the name of the function double (numbers): depends: If it's real it will map to a string representing that number If it's complex it will map to an object with the next properties: real: real part of the number imag: imaginary part of the number char: A string enclosed by double quotes representing that character logical: text sring "true" or "false" (w/o double quotes) And will map more complex octave values this other way: struct: an object with properties equal to the struct's field names and value equal to the json counterpart of that field cell: it will be mapped depending on the value of the cell (for example {i} will be mapped to an object with real=0 and imag=1) vectors or cell arrays: it will map them to a corresponding JSON array (same size) with the values transformed to their JSON counterpart (Note: that in JavaScript, all arrays are like octave's cells, i.e. they can store different type and size variables) strings or char vectors: they will be mapped to the same string enclosed by double quotes Other octave values will be mapped to a string enclosed by double quotes with the value that the class() function returns. It can handle escape sequences and special chars automatically. If they're valid in JSON it will keep them; if not they'll be escaped so they can become valid. object2json is deprecated. Better use toJSON or (in Octave-7+) jsonencode.
Package: io