jsonencode
encodes a Nelson object into a JSON string.
Syntax
res = jsonencode(obj)
res = jsonencode(obj, 'ConvertInfAndNaN', true_or_false)
Input argument
obj - a Nelson object: struct, cell, matrix.
true_or_false - a logical: if true, Inf, NaN are converted to 'Inf' or 'Nan'.
Output argument
res - a string: JSON text.
Description
jsonencode converts a Nelson variable to JSON text.
jsonencode does not support complex numbers, sparse arrays, function handle, and others handle.
jsonencode can be overloaded to manage your own type.
By default jsonencode Inf values are converted to the string "Inf", NaN values are converted to 'null'.
Warning: The shape of a matrix and data type are not always preserved.
Bibliography
http://www.rfc-editor.org/rfc/rfc7159.txt
Example
See also
History
Version | Description |
---|---|
1.0.0 | initial version |
Author
Allan CORNET
Last updated