JSONPath Query

This activity allows you to extract information from a JSON-formatted string. Instead of having to use complicated regular expressions to parse a JSON, you can use a JSONPath to traverse the JSON’s structure and extract the data you want.

Best Practices

Check the Continue Workflow Execution on Failure check box and use a Condition Block to check whether the path query was successful. Fail the workflow if the extraction was unsuccessful. This helps make sure your workflow fails with a useful error message and only continues if the path query succeeds.

Note: There are multiple implementations of JSONPath. Automation uses the Jayway implementation.

Usage

Complete the following properties to use this activity:

  • JSON Query
    • Source JSON to Query - Paste the JSON content into the text box or click the Variable Reference icon to choose a variable.
  • JSONPath Queries - Click Add and provide the following information:
    • JSONPath Query - Enter the query or click the Variable Reference icon to use a variable.
    • Property Name - Enter the name of the JSON property.
    • Property Type - Click the drop-down menu and choose the type of property the query will search for.

Sample Workflows

The following sample workflows are available in our repository’s workflows folder to help you get familiar with this concept. These can be imported using the instructions in Import Git Content or you can click the workflow to view it in GitHub.