JMESPath is a query language for JSON. Examples and a JMESPath tutorial can be found at the JMESPath site. It is used by the field code Action response details and the JWT parser function getFromJSON(). We describe how to get data from JSON objects which are returned as response from an action in after sending a REST request defined by the Atlassian Jira REST API. |
We introduce the main search terms that allow you to extract the relevant information from a response. For more complex ones, please have a look at the JMESPath specification.
you can access the values as described in the table below.
|
JMESPath is used by the field code Action response details and the parser function getFromJSON(). Syntactic rulesEscaping certain charactersWhen used in Action response details, the curly brackets have to be escaped:
Example:
When used in getFromJSON(), the quote has to be escaped
Example:The custom field with the custom ID 10010 holds the value
Parser expressions in JMESPath
Conversion from JSON types to stringThey always return a text, e.g. the boolean value If the result is not
but a JSON object itself, this JSON object will be converted to a text with The same is done if an array does not hold flat values but JSON objects. These results may be stored in a custom field and being read with the new parser function getFromJSON() in a different post function. Cast the text resultsIn case the result is not a text but e.g. a number or an array, you can cast it using the known functions from the parser like toNumber() or toStringList() and used as input for other parser functions or to set a field in post function like Create issue.
|
The following JSON is an excerpt of the response returned by a GET /rest/api/3/issue call for issue PU-670
The following table using the field code Action response details.
|