JSONPath Query
Category: Core
This activity allows you to easily extract information from a JSON-formatted string. Instead of having to use complicated regular expression to parse JSON, you can use a JSONPath to traverse the JSON’s structure and extract the data you want. These paths can be simple ($.user.firstName
) or complex ($.users[?(@.firstName == 'John')].phoneNumbers[0].number
).
Best Practices
- Check the
Continue Workflow Execution on Failure
box and use aCondition Block
to check whether or not the path query was successful. This helps make sure your workflow fails with a useful error message and only continues if the path query succeeds.
Hints
- There are more than one implementation of JSONPath. SecureX orchestration uses the Jayway implementation.
Helpful Links
- JSONPath Overview
- JSONPath Tester (More user friendly but uses a slightly different implementation of JSONPath)
- JSONPath Tester (Jayway) (Not as user friendly but uses the same implementation of JSONPath as SecureX)
Sample Workflows
The following sample workflows are available in our repository’s workflows folder to help you get familiar with this activity. These can be imported using the instructions here or you can view the workflow in GitHub by clicking on it.