Skip to main content

Quantela platform user manual

FilterJSON

Description

This function will use JSONata expression to query and filter a JSON object. JSONata is a lightweight query and transformation language for JSON data described in more detail at http://jsonata.org

Input

JSON

Output

JSON

Expression

The JSONata expression to be used to filter the input data. These are some examples:

  1. Accessing a particular value from JSON object: e.g. Account.Order[0].OrderID. The above expression gets the OrderID value from the first item of the Orders list. Account is JSON object, Order is JSON array and OrderID is the key.

  2. Numeric functions can be used such as $number(), $abs(), $floor(), $ceil(), $round(), $sq rt().

  3. Aggregation functions can also be used: $sum(), $max(), $min(), $average().

  4. Sorting functions can sort the data based on one or more attributes. The example below sorts an array of beer styles based on the updateDate attribute. e.g. $sort(data.style, function($l, $r) { $l.updateDate < $r.updateDate }).