dejson(S;O)
Converts a JSON string into 1010data values. (Available as of version 11.07)
Syntax
dejson(S;O)
Input
Argument | Type | Description |
---|---|---|
S |
text | A JSON string of name-value pairs |
O |
text | A list of one or more special options: 'funnykeys' ,
'nofunnykeys' , 'uqkeys' ,
'nouqkeys' , and 'symbols'
|
Return Value
Returns a 1010data value represented by the JSON string. If the function cannot convert the
JSON string, dejson
throws an error message.
Example
The following example shows how dejson(string;)
converts a "mixed" JSON
string into package of name-value pairs that 1010data can use.
<base table="default.test.json"/>
<colord cols="mixed"/>
<willbe name="p" value="dejson(mixed;'symbols')"/>
<willbe name="a" value="pkg_default(p;'a';98.6)"/>
<willbe name="c" value="pkg_default(p;'c';'noun')"/>
The resulting table is as follows:
In column p, dejson(string;)
converts the mixed
JSON into a package of name-value pairs. Column a contains the value
of a
, and column c contains the value of
c
. In the third row of the table, the data type for c
does not match the default, so the default value, noun, is
used. The last row of the table does not contain an a
or c
value, so the a and c columns contain the
default values 98.6 and noun,
respectively. See pkg_default(P;K;D)
for more information.