Logic: JSON Transform

Knowledge Center > Workflow > Workflow Tasks > Logic: JSON Transform

Logic: JSON Transform

Table of contents

The JSON transform task transforms JSON data in the data payload into XML format or a different JSON structure.

After the JSON transform task, the original data is kept in the data payload and the output data is added to the data payload. 

Task Settings

When creating a JSON transform task, you need to select a processor.

  • JSONata: Select this processor if you want to transform the JSON data into another JSON structure. With JSONata expressions, you can filter and aggregate data, and reformat data into any JSON structure. To learn more about the JSONata syntax and available functions, see JSONata.
  • XML: Select this processor if you want to transform the complete JSON data into an XML file.

If you select the JSONata processor, the transformed data will be placed under the JSONTransform object in the data payload by default. If necessary, you can modify the placement of the data.

Examples

If an upstream task exports data from Account, Subscription, and BillToContact, you can use a JSON transform task to reformat the results into a different JSON structure. The new structure creates a new object. The new object defines a few keys and uses the field values from the input JSON data as the values of the keys.

{
"AccountNumber": Account.Number
"AccountBalance": Account.Balance
"SubscriptionID": Subscription.Id
"ContractEffectiveDate": Subscription.ContractEffectiveDate
"AccountCountry": BillToContact.Country
}

In the expression above, "AccountNumber" is a key of the new object, and Account.Number points to a value from the input JSON data.

Last modified

Tags

Classifications

(not set)