PhenixID

Handle Json Array

Version: 1.0

Category: Process

Extended Category: JSON

Action Package: Standard Actions

Description

Convert a JSON array to a multi value session attribute or convert a multi value session attribute to a JSON array.

Parameter Description Example
Source Attribute[Mandatory] The attribute that contains the data to be transformed.jsonObjects
Result Attribute[Optional] The attribute to put the result in. Leave empty to replace the source attribute value with the result.jsonArray
Convert Mode[Optional] The conversion to make. 1 = Convert a JSON array value to a multi value attribute. 2 = Convert a multi value attribute to a JSON array. Default: 12

Use Cases

Example 1 – Convert Session Attribute Values to JSON Array

Multi value session attribute ‘pets’ on the session object:

'{"name":"Charlie","animal":"dog"}'
'{"name":"Belle","animal":"cat"}'
Parameter Value
Source Attributepets
Result AttributepetsArray
Convert Mode2

New session attribute ‘petsArray’ after the action has run:

'[{"name":"Charlie","animal":"dog"},{"name":"Belle","animal":"cat"}]'

Printer friendly, the value is:

[
    {
      "name":"Charlie",
      "animal":"dog"
    },
    {
      "name":"Belle",
      "animal":"cat"
    }
]

Example 2 – Convert JSON Array to Multi Value Session Attribute

Session attribute ‘petsArray’ on the session object:

'[{"name":"Charlie","animal":"dog"},{"name":"Belle","animal":"cat"}]'

Printer friendly, the value is:

[
    {
      "name":"Charlie",
      "animal":"dog"
    },
    {
      "name":"Belle",
      "animal":"cat"
    }
]
Parameter Value
Source AttributepetsArray
Result Attributepets
Convert Mode1

New session attribute ‘pets’ after the action has run has the following multi values:

'{"name":"Charlie","animal":"dog"}'
'{"name":"Belle","animal":"cat"}'


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