...
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
Info |
---|
Int4 IFTT converts JSON files to JSON-XML - SAP-specific representation of JSON data in XML format. It is possible to use Xpath expressions for JSON files based on this representation. Such expressions have to be preceded with '$' sign. |
JSON-XML representation of above file:
Code Block | ||
---|---|---|
| ||
<?xml version="1.0"?>
<object>
<object name="order">
<array name="item">
<object>
<str name="category">Monitors</str>
<str name="itemText">LCD Monitor 22 inch</str>
<num name="price">128.95</num>
</object>
<object>
<str name="category">Printers</str>
<str name="itemText">Label Printer</str>
<num name="price">56.99</num>
</object>
<object>
<str name="category">Monitors</str>
<str name="itemText">LCD Monitor 24 inch Full HD</str>
<num name="price">211.99</num>
</object>
<object>
<str name="category">Printers</str>
<str name="itemText">Laser Printer</str>
<num name="price">77.99</num>
</object>
</array>
<object name="paymentTerms">
<str name="code">N30</str>
<str name="description">Payment 30 days after invoice date</str>
</object>
</object>
</object> |
Select prices of items in Printer category
Expression: $//array[@name="item"]/object[str[@name = 'category']/text() = 'Printers' ]/num[@name="price"]/text()
Result:
56.9977.99