CSM 10.5 Documentation

Home

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. See also Webhook Modifier Examples.

The following modifiers can be applied to JSON data. The examples use a JSON collection from a store.

Collection of JSON data from a book 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:

Date Time from Element JSON 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:

Find Array JSON Modifier

Result:

Information

[
{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
},
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{
"category": "fiction",
"author": "Herman Melville",
"title": "Moby Dick",
"isbn": "0-553-21311-3",
"price": 8.99
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
]

Find Object

Finds and returns the JSON object from a specified name.

Example: Retrieve the bicycle object from the JSON collection.

Modifier:

Find Object JSON Modifier

Result:

{
"color": "red",
"price": 19.95,
"used": "True",
"returnDate": "2012-04-23T18:25:43.5111Z"
}

JSON Path (replace)

Uses a JSON path query to replace a value within a JSON document.

Example: Update the price of the bicycle to 20.95.

Modifier:

JSON Path (replace) Modifier

Result: (Full JSON value is returned with updated value from replace)

JSON Path (value)

Returns a single value based on the provided JSON path.

Example: Find a book with a price less than $8.99.

Modifier:

JSON Path (value) Modifier

Result:

{
"category": "reference",
"author": "Nigel Rees",
"title": "Sayings of the Century",
"price": 8.95
}

JSON Path (array)

Returns an array of values based on the provided JSON path.

Example: Find books with a price greater than $10.00.

Modifier:

JSON Path (value) Modifier

Result:

[
{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
},
{
"category": "fiction",
"author": "J. R. R. Tolkien",
"title": "The Lord of the Rings",
"isbn": "0-395-19395-8",
"price": 22.99
}
]

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:

Logical from Element JSON Modifier

Result:

True 
		

Number from Element

Returns a numerical value from a specified JSON element.

Example: Retrieve the price of the 4th book.

Modifier:

Number from Element JSON 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:

String from Element JSON 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)

Go to Array Index JSON Modifier

Result:

{
"category": "fiction",
"author": "Evelyn Waugh",
"title": "Sword of Honour",
"price": 12.99
}
{


Was this article useful?