Details
-
Story
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
Security Level: Users (General product issues)
-
3
-
UNDECIDED
-
Green Sprint 106, Green Sprint 107, Green Sprint 108
Description
Introduce two new functions:
- function variant json2variant(<json_string>) - parses the specified JSON string and creates CTL “representation” of it - i.e. potentially complex structure of maps&lists&primitive types.
variant myvariant; myvariant=json2obj('\{"city":"chicago","name":"jon doe","age":"22"}’); printErr(myvariant);
Produces following output:
{city=chicago, name=jon doe, age=22}
JSON boolean is parsed to boolean, numbers to long (if integer) or decimal (if decimal part present).
- function string variant2json(<variant var>|list|map) - serializes passed parameter into JSON style string.
variant any; any={}; any["A"]=[1,2,3]; any["B"]=[true, false]; any["C"]=\{"name"->"John", "surname"->"Doe"}; printErr(obj2json(any));
Produces:
{"A":[1,2,3],"B":[true,false],"C":{"surname":"Doe","name":"John"}}
Attachments
1.
|
json2obj() does not decode escape sequences |
|
Closed | Martin Slama | ||||||||
2.
|
Add parseJson function |
|
Closed | Roland Botka | ||||||||
3.
|
Add writeJson function |
|
Closed | Roland Botka | ||||||||
4.
|
Update documentation |
|
Closed | Milan Krivanek |
|
|||||||
5.
|
Rename the functions |
|
Closed | Lukas Adamek |