Reads the value of a JSON file to a variable.
Syntax |
Description |
---|---|
a=jsonread("filename"); |
Reads the values of the json file (struct, cell, string, number) and coverts the json lists to Lumerical cells and assign the result to the variable "a". Note that the "jsonread" result must be assigned to a variable. |
Example
The following code example shows how to read the data of the JSON file "test_jsonread.json" to the variable "a". The data in file "test_jsonread.json" is:
{ "element" : { "name" : "straight_waveguide", "prefix": "WG" } }
The read and output result looks like:
a = jsonread("test_jsonread.json");
?a.element.name;
straight_waveguide
See Also
jsonsave , jsonloads , jsonsaves , jsonreads, jsonwrite, jsonwrites, JSON files