The JSONPath Evaluation Processor populates transaction and/or global attributes with the evaluations of JSONPath expressions.
Processor (Adapter) Configuration Drop-Down List
Select the JSONPath Evaluation tab and click on Add Processor.
Click on Add Processor
Basic JSONPath Evaluation Processor Configuration Options
On the Basic tab you can set:
- Attributes to Set – a table of the JSONPath expressions and the attributes they are to be mapped to
- Global Attributes – sets globally accessible attributes which are available to all transactions
JSONPath Evaluation Processor Basic Configuration Options
The JSONPath Evaluation processor parsing a JSON document in the transaction body and runs JSONPath evaluation strings against it. The results from executing the JSONPath strings are populated in configured transaction attributes. An example message below represents a list of items and a date in JSON:
To retrieve the date in the above document, the JSONPath would look as follows:
Where ‘$’ represents the root of the document and ‘.date’ represents the date key in which the value is to be retrieved from. To grab a value deeper in the tree, you would simply append indexes and object keys as necessary. For example, to retrieve a price from the above document, the JSONPath would look as follows:
This would return ‘1.23’. The configuration of the above scenarios in the processor can be seen below.
Processor Attributes Configuration Screen
When executed, you can see the results in your transaction attributes:
Transaction Attributes Example
If more than one result is returned or could potentially be returned, the resulting attribute value will be represented by a JSON array of values.
Additional documentation on how to create JSONPath queries can be found here.
Conditional Execution JSONPath Evaluation Processor Configuration Options
On the Conditional Execution tab, you can set additional Processor execution conditions. The transaction data dependent condition may be specified here as an enhanced expression. If this expression returns anything other than TRUE (ignore case) – this processor will be skipped. No additional configuration for this Processor is required.
Conditional Execution of the JSONPath Evaluation Processor