Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. All item texts
    JSONPath: $.order.item[*].itemText

    Result:
    LCD Monitor 22 inch

    Label Printer

    LCD Monitor 24 inch Full HD

    Laser Printer

  2. Price of 3rd item
    JSONPath: $.order.item[2].price

    Result:
    211.99

  3. All categories
    JSONPath: $..category

    Result:
    Monitors

    Printers

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.
This feature can be used in case it is not possible to select required values with current scope of JSONPath syntax.

JSON-XML representation of above file:

Code Block
languagexml
<?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>
  1. Select prices of items in Printer category
    Expression: $//array[@name="item"]/object[str[@name = 'category']/text() = 'Printers' ]/num[@name="price"]/text()

    Result:
    56.99

    77.99