Conigma Connect
JSONPath
Introduction
All data within contexts is accessed using JSONPath. Conigma Connect uses the JsonPath.Net library for resolving these paths, and this functionality is directly available to the user in the flow editor. While the
The examples are built towards the following example JSON object:
Rendering...
Property Access
Dot Notation
$.customer.name
Dot notation is the simplest way to access properties with valid JSON names. Above example selects the name property from the customer object at the root level.
Result: Alice
Bracket Notation
$['customer']['maxPrice']
Bracket notation is required when property names contain spaces, dots, or special characters.
Result: 500
Arrays and Recursive Access
Index
$.customer.orders[0].status
Selects the status of the first order.
Result: shipped
$.customer.orders[-1].status
Selects the status of the last order.
Result: shipped
Slice
$.customer.orders[0:2]
Selects a range of array elements.
Result:
Wildcard
$.customer.orders[*].status
Selects the status of every order.
Result: ["shipped", "processing", "cancelled", "shipped"]
Multiple Properties
$.customer.orders[*]['status','orderId']
Selects both status and orderId values from every order item.
Result: ["shipped","O-501","processing","O-502","cancelled","O-503","shipped","O-504"]
Recursive Descent
$..sku
Searches for the property sku at any depth.
Result: ["A100", "B200", "C300", ...]
Filters
Local Scope (@)
$.customer.orders[?(@.status == 'shipped')].orderId
Returns order IDs where the local status equals "shipped".
Result: ["O-501", "O-504"]
Global Scope ($)
$.customer.orders[?(@.items[0].price < $.customer.maxPrice)].orderId
Filters by comparing values to another part of the document.
Result: ["O-502", "O-503", "O-504"]
length()
$.customer.orders[?(length(@.items) > 1)].orderId
Returns orders containing more than one item.
Result: ["O-501", "O-502", "O-504"]
count()
$.customer.orders[?(count(@.items[*]) == 1)].orderId
count() returns the number of JSON nodes in the selected node set. In this case all orderIds are selected where the order has only one item.
Result: ["O-503"]
The JSONPath does not process an array’s length unless you first expand the array into its element nodes using the wildcard [*]!
Correct: count(@.items[*]) == 1 // counts element nodes
Incorrect: count(@.items) == 1 // counts the single array node itself
match()
$.customer.orders[?(match(@.status, 'shipped'))].orderId
Checks for exact regex matches.
Result: ["O-501", "O-504"]
search()
$.customer.orders[*].items[?(search(@.name, 'top'))].sku
Checks for any substring regex matches.
Result: ["A100"]
Overview Table
Note: The contents of the table are just abstract examples and do not refer to the example JSON above.
Feature | Example Path | Description |
|---|---|---|
Root element |
| Accesses a property at the root |
Property (dot) |
| Gets a child property by name |
Property (dot) |
| Gets a child property using bracket syntax |
Array index |
| Selects the first element in an array |
Array index |
| Selects the last element in an array |
Slice |
| Selects a range of array elements |
Wildcard |
| Selects properties of all elements |
Multiple Properties | | Selects both name and price as a flat list |
Recursive descent |
| Searches for a property at any depth |
Local @ |
| Filters array elements by condition on the element itself |
Global $ |
| Filters using values from elsewhere |
length() |
| Filters by length of an array property |
count() |
| Filters by number of nodes |
match() |
| Filters by exact regex match |
search() |
| Filters by substring regex search |