JSON Modifiers
Use JSON Modifiers to pull pieces of JSON data into CSM in a usable format. For example, use JSON Modifiers with webhooks to parse, change, and use data between an external tool and CSM.
JSON modifiers build on each other and typically must be used in conjunction with each other to return useful values. In addition, Field Tokens can be used in the modifiers.
The following Modifiers can be applied to JSON data. The examples use a JSON collection from a store.
Date Time from Element
Returns a date time value from a specified JSON element.
Example: Retrieve the return date value for the bike in the JSON collection.
Modifier:
Result: 2012-04-23T18:25:43
Find Array
Finds and returns a JSON array from a specified name.Example: Retrieve the list of books from the store's JSON collection of inventory.
Modifier:
Result:
Find Object
Finds and returns the JSON object from a specified name.Example: Retrieve the bicycle object from the JSON collection.
Modifier:
Result:
{
"color": "red",
"price": 19.95,
"used": "True",
"returnDate": "2012-04-23T18:25:43.511Z"
}
JSON Path (replace)
Uses a JSONpath query to replace a value within a JSON document.Example: Update the price of the bicycle to 20.95.
Modifier:
Result: (Full JSON value is returned with updated value from replace)
JSON Path (value)
Returns a value based on the provided JSONpath.Example: Find books with a price less than $8.99.
Modifier:
Result:
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
}
Logical from Element
Returns a logical value from a specified JSON element.Example: Retrieve the previously owned value for the bicycle in the store.
Modifier:
Result: True
Number from Element
Returns a numerical value from a specified JSON element.Example: Retrieve the price of the 4th book.
Modifier:
Result: 22.99
String from Element
Returns a string value from a specified JSON element.Example: Get the title of the 3rd book in the JSON collection.
Modifier:
Result: Moby Dick
Goto Array Index
Returns the JSON object at the specified index of the JSON array.Example: Go to the 2nd book in the JSON collection.
Modifier: (array index values start at 0)
Result:
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}