PhenixID

Convert Json to Structured Csv

Version: 1.0

Category: Process

Extended Category: JSON

Action Package: Standard Actions

Description

Convert a JSON value in a session attribute to a structured CSV value.

Parameter Description Example
JSON Attribute[Mandatory] The name of the session attribute with the JSON value.jsonPerson
Result Attribute[Optional] To create a new session attribute with the result, instead of over writing the value in the original attribute, enter a session attribute name.csvPerson
Properties Separator[Optional] The separator between the properties. Default: ||
Name and Value Separator[Optional] The separator between the property name and the property value. Default: >>
Multiple Values Separator[Optional] The separator between multiple property values. Default: §§
Marker for non String Values[Optional] The character that marks that a value is not a string value. Default: ##

Use Cases

Example 1: Convert a single JSON object

Converting a single JSON object from attribute jsonPerson to a new attribute called csvPerson, using the default characters.

jsonPerson:

{
  "sn":"Smith",
  "givenName":["Bob","Lee"],
  "age":45,
  "alive":true,
  "childrenAge":[3,4,7]
}

csvPerson:

sn>Smith|givenName>Bob§Lee|age>#45|alive>#true|childrenAge>#3§4§7

Example 2: Convert a JSON array

Converting a JSON array from attribute jsonPersons to a new attribute called csvPersons, using the default characters. The attribute csvPersons will become a multivalue attribute.

jsonPersons:

[
  {
    "sn":"Smith",
    "givenName":["Bob","Lee"],
    "age":45,
    "alive":true,
    "childrenAge":[3,4,7]
  },
  {
    "sn":"Clarson",
    "givenName":"Susan",
    "age":48,
    "alive":true,
    "childrenAge":[4,6]
  }
]

csvPersons:

sn>Smith|givenName>Bob§Lee|age>#45|alive>#true|childrenAge>#3§4§7

sn>Clarson|givenName>Susan|age>#48|alive>#true|childrenAge>#4§6

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