Matlab has built-in support for JSON (JavaScript Object Notation) through the functions jsonencode
and jsondecode
.
To parse a JSON string, use jsondecode
. It takes a string and returns a MATLAB structure.
main.m93 chars3 lines
To create a JSON string from a MATLAB structure, use jsonencode
. It takes a MATLAB structure and returns a JSON string.
main.m90 chars5 lines
In both cases, the output variables can be further parsed or used as necessary.
gistlibby LogSnag