Omnistudio JSON Object Functions

Functions that operate on JSON objects.

Omnistudio DESERIALIZE Function

Converts a JSON string into a JSON object.

Deserialization converts a serialized JSON string into its JSON object structure. Serialization and deserialization promote the efficient exchange of data between different systems and applications.

Signature

DESERIALIZE(jsonString)

Return Value

JSON object

Parameters

Parameter

Data Type

Necessity

Description

jsonString

 

Required

The previously serialized JSON string to be deserialized.

JSON Object Example
JSON Object Example

Sample data: "SerializedContact": "{"LastName":"Edison","MiddleName":"Alva","FirstName":"Thomas"}"

Formula: DESERIALIZE(%SerializedContact%)

Return value:

{
  "MiddleName": "Alva",
  "LastName": "Edison",
  "FirstName": "Thomas"
}
JSON Array Example
JSON Array Example

Sample data: "SerializedContacts": "[{"lastName":"Jones","firstName":"Cathy"},{"lastName":"Smith","firstName":"Albert"},{"lastName":"Smith","firstName":"Ben"}]"

Formula: DESERIALIZE(%SerializedContacts%)

Return value:

[
  {
    "firstName": "Cathy",
    "lastName": "Jones"
  },
  {
    "firstName": "Albert",
    "lastName": "Smith"
  },
  {
    "firstName": "Ben",
    "lastName": "Smith"
  }
]

Omnistudio RESERIALIZE Function

Reserializes a previously serialized JSON string.

The RESERIALIZE function is equivalent to calling the DESERIALIZE(SERIALIZE()) functions. The function converts a JSON string into a generic Map<String, Object> format. It is useful in remote actions for converting Apex class output to a format that Data Mappers and Integration Procedures can accept. For more information, see Remote Action for Integration Procedures

Signature

RESERIALIZE(jsonString)

Return Value

JSON string

Parameters

Parameter

Data Type

Necessity

Description

jsonString

JSON string

Required

The previously serialized JSON string to be reserialized.

JSON Object Example
JSON Object Example

Sample data: "SerializedContact": "{"LastName":"Edison","MiddleName":"Alva","FirstName":"Thomas"}"

Formula: RESERIALIZE(%SerializedContact%)

Return value: "{"LastName":"Edison","MiddleName":"Alva","FirstName":"Thomas"}"

JSON Array Example
JSON Array Example

Sample data: "SerializedContacts": "[{"lastName":"Jones","firstName":"Cathy"},{"lastName":"Smith","firstName":"Albert"},{"lastName":"Smith","firstName":"Ben"}]"

Formula: DESERIALIZE(%SerializedContacts%)

Return value: "[{"lastName":"Jones","firstName":"Cathy"},{"lastName":"Smith","firstName":"Albert"},{"lastName":"Smith","firstName":"Ben"}]"

Omnistudio SERIALIZE Function

Converts a JSON object into a JSON string.

Serialization converts a JSON object into a JSON string that can be easily stored, transmitted, and restored to its original object structure. Serialization and deserialization promote the efficient exchange of data between different systems and applications. (The results of the SERIALIZE function are different from the results of the TOSTRING function.)

Signature

SERIALIZE(jsonObject)

Return Value

JSON string

Parameters

Parameter

Data Type

Necessity

Description

jsonObject

JSON object

Required

The JSON object to be serialized. Use the LIST function to pass a JSON array.

JSON Object Example
JSON Object Example

Sample data:

"Contact": {
  "FirstName": "Thomas",
  "MiddleName": "Alva",
  "LastName": "Edison"
}

Formula: SERIALIZE(%Contact%)

Return value: "{"LastName":"Edison","MiddleName":"Alva","FirstName":"Thomas"}"

JSON Array Example
JSON Array Example

Sample data:

"Contacts": [
  {
    "lastName": "Jones",
    "firstName": "Cathy"
  },
  {
    "lastName": "Smith",
    "firstName": "Albert"
  },
  {
    "lastName": "Smith",
    "firstName": "Ben"
  }
]

Formula: SERIALIZE(LIST(%Contacts%))

Return value: "[{"lastName":"Jones","firstName":"Cathy"},{"lastName":"Smith","firstName":"Albert"},{"lastName":"Smith","firstName":"Ben"}]"

Omnistudio VALUELOOKUP Function

Returns the value of a node that exists at any depth of a JSON object hierarchy.

The function returns the value of a JSON node referred to by another JSON node. The function lets you retrieve a specified node dynamically.

Signature

VALUELOOKUP(startNode, node...)

Return Value

String

Parameters

Parameter

Data Type

Necessity

Description

startNode

JSON node

Required

A node or node path of a JSON object. The node or node path must begin at the root of the JSON object from which values are to be returned. For example, for the Name object of a Contact object, you can specify Contact, Name or Contact:Name. Use a node path to traverse a JSON array.

node...

JSON node

Required

A comma-separated list of one or more nodes of a JSON object. Each node must either be an immediate child of the previously specified node or refer to a child of that node. The final node must identify the node whose value is to be returned.

JSON Object Example
JSON Object Example

Sample data:

"Contact": {
  "Name": {
    "FirstName": "Thomas",
    "MiddleName": "Alva",
    "LastName": "Edison"
  },
  "Address": {
    "City": "San Francisco",
    "State": "CA",     
    "ZipCode": 94110
  }
},
"GetNameGroup": "Name",
"GetLastNameField": "LastName",
"GetAddressGroup": "Address",
"GetStateField": "State"

Formula: VALUELOOKUP(Contact, GetNameGroup, GetLastNameField)

Formula: VALUELOOKUP(Contact:Name, GetLastNameField)

Return value: "Edison"

Formula: VALUELOOKUP(Contact, GetNameGroup)

Return value:

{
  "MiddleName": "Alva",
  "LastName": "Edison",
  "FirstName": "Thomas"
}

Formula: VALUELOOKUP(Contact, GetAddressGroup, GetStateField)

Formula: VALUELOOKUP(Contact:Address, GetStateField)

Return value: "CA"

Formula: VALUELOOKUP(Contact, GetAddressGroup)

Return value:

{
  "City": "San Francisco",
  "ZipCode": 94110,
  "State": "CA"
}
JSON Array Example
JSON Array Example

Sample data:

"AccountList": [
  {
    "CaseList": [
      {
        "Case1": {
          "CreatedDate": "2/1/2024T16:35:30 GMT -0500 (EDT)",
          "LastUpdate": "2/8/2024T09:15:00 GMT -0500 (EDT)",
          "NextCase": "Case2"
        }
      },
      {
        "Case2": {
          "CreatedDate": "2/2/2025T11:05:05 GMT -0500 (EDT)",
          "LastUpdate": "2/3/2025T15:50:57 GMT -0500 (EDT)",
          "NextCase": "Case3"
        }
      },
      {
        "Case3": {
          "CreatedDate": "2/4/2025T11:05:05 GMT -0500 (EDT)",
          "LastUpdate": "2/6/2025T15:50:57 GMT -0500 (EDT)",
          "NextCase": null
        }
      }
    ]
  }
],
"GetFirstCase": "Case1",
"GetNextCase": "NextCase"

Formula: IF(GetFirstCase, GetFirstCase, "Empty list")

Return value: "Case1"

Formula: VALUELOOKUP(AccountList:CaseList:Case1, GetNextCase)

Return value: "Case2"

Formula: VALUELOOKUP(AccountList:CaseList:Case2, GetNextCase)

Return value: "Case3"

Formula:

IF(VALUELOOKUP(AccountList:CaseList:Case3, GetNextCase),
  VALUELOOKUP(AccountList:CaseList:Case3, GetNextCase),
  "End of list")

Return value: "End of list"