json_simpleΒΆ
json_simple converts a valid json string into a UniScript object.
- o = json_simple(ssjson)
Return Value
o is a json tree or an Error object (see error_create).
o = json_simple( "{\"a\":1, \"b\":2}");
[.
a = 1,
b = 2,
]
json_simple("{\"a\": [1,2,3]}");
[.
a[1;3] = [1, 2, 3]
]
json_simple("[1, \"text\", true, false, null, {\"a\":1}, [2,3]]");
[.
[1] = 1,
[2] = "text",
[3] = 1,
[4] = 0,
[5] = 1e+10,
[6] = [.
a = 1,
],
[7][1;2] = [2, 3]
]
s = "{" ..
+"\"name\": \"John\"," ..
+"\"age\": 30," ..
+"\"married\": false," ..
+"\"children\": null," ..
+"\"skills\": [\"UniPlot\", \"UniScript\", \"JSON\"]" ..
+"}";
o = json_simple(s);
[.
age = 30,
children = 1e+10,
married = 0,
name = "John",
skills[1;3] = ["UniPlot", "UniScript", "JSON"],
]
Parameters
- ssjson
ssjson is a valid json string.
Comment
The json_simple function
Converts null to 1e10 (missing values)
Stores arrays of objects into key/object pairs
Converts True to 1 and False to 0
History
Version |
Description |
|---|---|
R2026.0 |
New. |
See also
id-667216