jsondecode

decodes a JSON string to Nelson object.

Syntax

  • res = jsondecode(json_str)

Input argument

  • json_str - a json string.

Output argument

  • res - a nelson variable converted from JSON.

Description

jsondecode converts JSON object field names to Nelson structure field names

Bibliography

http://www.rfc-editor.org/rfc/rfc7159.txt

Examples

field1 = 'f1';  value1 = zeros(1,10);
field2 = 'f2';  value2 = {'a', 'b'};
field3 = 'f3';  value3 = {pi, pi*pi};
field4 = 'f4';  value4 = {'fourth'};
s = struct(field1,value1,field2,value2,field3,value3,field4,value4)
r = jsonencode(s)
r2 = jsondecode(r)
jsondecode(fileread([modulepath('json'), '/examples/patient.json']))

See also

jsonencode, fileread.

History

Version
Description

1.0.0

initial version

Author

Allan CORNET

Last updated