Function: jsonToItems()
Converts a block JSON data to a set of attributes. This can be useful if you need to extract the values from within JSON data.
Syntax
jsonToItems(JSON String, JSON Path, Lenient)
Argument | Type | Description |
---|---|---|
JSON String | String | JSON string to be converted to attribute values. |
JSON Path | String | The JSON Path expression is evaluated against the data provided by the JSON String. It determines which elements are extracted from the JSON. Defaults to “$” which matches the entire document. |
Lenient | boolean | Lenient is a flag which determines whether to pass the JSON String leniently. Defaults to false. |
Path Syntax
Expression Description $
symbol refers to the root element. @
symbol refers to the current element. .
is the dot-child operator, which is used to denote a child element of the current element. [ ]
is used to select a child element of the current element (by name or index number). *
a wildcard, returning all elements regardless of their name. ^ symbol is used to traverse up 1 element in the JSON hierarchy from child to parent.
Expression | Description |
---|---|
| symbol refers to the root element. |
@ | symbol refers to the current element. |
. | is the dot-child operator, which is used to denote a child element of the current element. |
[ ] | is used to select a child element of the current element (by name or index number). |
* | a wildcard, returning all elements regardless of their name. |
^ | symbol is used to traverse up 1 element in the JSON hierarchy from child to parent. |
Example
jsonToItems("{data:{status:'success'}}", "$..status", true)
Generates
TBC