Version: 1.0.0
Category: Process
Extended Category: JSON
Action Package: Standard Actions
Description
Read a value from JSON using JSON Pointer (RFC6901).
Supports SESSION and GLOBAL parameters.
Parameter | Description | Example |
Source Attribute | The session attribute containing the JSON to read from | source |
Target Attribute | The session attribute to store the read value in | target |
JSON Pointer | The JSON Pointer to locate the value in the JSON stored in Source Attribute | /key |
Multi Value | If the value is an array. The items will be added to the target attribute making it a multi value attribute. Default is false | false |
Failure Attribute | The attribute to store the fail message. Won’t store the fail message unless specified | failMsg |
Use Cases
The example will use a session object with the attribute source containing the following JSON:
{
"firstName": "John",
"lastName" : "Doe",
"age" : 26,
"address" : {
"streetAddress": "Street 1",
"city" : "City",
"postalCode" : "123456"
},
"phoneNumbers": [
{
"type" : "mobile",
"number": "0123-4567-8888"
},
{
"type" : "home",
"number": "0123-4567-8910"
}
]
}
Example 1: Read a value
Parameter | Value |
Source Attribute | source |
Target Attribute | target |
JSON Pointer | /firstName |
The session object will after execution have a new attribute target that contains the string John.
Example 2: Read an array as store it as a multi value
Parameter | Value |
Source Attribute | source |
Target Attribute | target |
JSON Pointer | /phoneNumbers |
Multi Value | true |
The session object will after execution have a new multi value attribute target that contains the values:
- {“type”:”mobile”,”number”:”0123-4567-8888″}
- {“type”:”home”,”number”:”0123-4567-8910″}
Example 3: Read an array an store it as JSON array
Parameter | Value |
Source Attribute | source |
Target Attribute | target |
JSON Pointer | /phoneNumbers |
Multi Value | false |
The session object will after execution have a new attribute target that contains the JSON [{“type”:”mobile”,”number”:”0123-4567-8888″},{“type”:”home”,”number”:”0123-4567-8910″}]
Example 4: Read an array element
Parameter | Value |
Source Attribute | source |
Target Attribute | target |
JSON Pointer | /phoneNumbers/1 |
The session object will after execution have a new attribute target that contains the JSON {“type”:”home”,”number”:”0123-4567-8910″}.
Example 5: Read a value from a array element
Parameter | Value |
Source Attribute | source |
Target Attribute | target |
JSON Pointer | /phoneNumbers/1/type |
The session object will after execution have a new attribute target that contains the string home.
DISCLAIMER
Information provided in this document is for your information only. PhenixID makes no explicit or implied claims to the validity of this information. Any trademarks referenced in this document are the property of their respective owners.The origin of this information may be internal or external to PhenixID. PhenixID makes all reasonable efforts to verify this information.
PhenixID - support.phenixid.se