json()

Read(292) Label: json string, record, parse,

Description:

Parse a string, a record or a table sequence in JSON format.

Syntax:

  json(x)

Note:

If parameter x is a JSON string, the function parses it into a table sequence to return; if parameter x is a record or a table sequence, the function parses it into a JSON string to return.

Parameters:

x

A JSON string/record/sequence

Return value:

A table sequence/JSON string

Example:

1

{name:'China',province:[{name:'Heilongjiang',cities:

{city:['Harbin','Daqing']}},{name:'Guangdong',

cities:{city:['Guangzhou','Shenzhen','Zhuhai']}},{name:'Taiwan',cities:

{city:['Taipei','Kaohsiung']}},{name:'Xinjiang',cities:{city:['Urumqi']}}]}

 

2

=json(A1)

A1 is a JSON string, which is parsed into a table sequence and return the result:

3

=demo.query("select EID,NAME,SURNAME from EMPLOYEE")

4

=json(A3)

A3 is a table sequence, which is parsed into a JSON string and return the result: