USE:
JSONPath expressions are used to operate on JSON messages.
For testing JSONPath expressions see Int4 IFTT Expression Test Tool
Int4 IFTT supports JSONPath expressions in dot-notation.
Here is a list of supported syntax elements and their XPath equivalents.
XPath | JSONPath | Description |
---|---|---|
/ | $ | root element/object |
// | .. | recursive descent |
* | * | wildcard (all objects) |
[] | [] | collection/array operator |
Examples:
JSON file:
{ "order": { "item": [{ "category": "Monitors", "itemText": "LCD Monitor 22 inch", "price": 128.95 }, { "category": "Printers", "itemText": "Label Printer", "price": 56.99 }, { "category": "Monitors", "itemText": "LCD Monitor 24 inch Full HD", "price": 211.99 }, { "category": "Printers", "itemText": "Laser Printer", "price": 77.99 } ], "paymentTerms": { "code": "N30", "description": "Payment 30 days after invoice date" } } }
All item texts
JSONPath: $.order.item[*].itemText
Result:
LCD Monitor 22 inchLabel Printer
LCD Monitor 24 inch Full HD
Laser Printer
Price of 3rd item
JSONPath: $.order.item[2].price
Result:
211.99All categories
JSONPath: $..categoryResult:
MonitorsPrinters