More ways to use code in Automation, e.g. ability to use JSON path expressions to query JSON data in web request responses

XMLWordPrintable

    • Type: Suggestion
    • Resolution: Unresolved
    • Component/s: None
    • None

      Currently, if we have a complex JSON response from a web request action, we can only do a simple traversing of it using JSON object notation. However, should there be arrays in the response and we need to get a certain array key, that notation wouldn't work unless we use an array index, which is not ideal.

      For example, if we want to query Insight object attributes, we can send a request to /jira/rest/insight/1.0/object/33542/attributes and then if we need to get this value from the response:

      webhookResponse.body.objectEntries.[0].attributes[?(@.objectTypeAttributeId==3701)].objectAttributeValues[0].user.key

      It is not possible to do that like that. Best we could do is to hard code an array index in smart values:

      webhookResponse.body.objectAttributeValues.get(4).user.key

      But this is far less than ideal.

      A4J should support for flexible querying of the JSON data, such as:

      • possibility to run JSONPath expressions directly on the webhook response
      • possibility to add expressions like "objectTypeAttributeId = xxx" in the smart value syntax.

       

       

      Workaround

      This article provides a workaround for certain cases in the "Filtering without using branching" section.

            Assignee:
            Charlie Gavey
            Reporter:
            Jose Luis Gonzalez
            Votes:
            51 Vote for this issue
            Watchers:
            29 Start watching this issue

              Created:
              Updated: