Hi,
Jira automation question.
I'm using https://xray.cloud.getxray.app/api/v2/graphql to get the related tests of a test execution. This works fine and I get the correct result.
{data={getTestExecutions={results=[{issueId=188800, jira={key=TEST-13621}, tests={results=[{issueId=180163, jira={key=TEST-11939, summary=Add sales order, assignee=null}}, {issueId=180164, jira={key=TEST-11940, summary=Mandatory field validation, assignee=null}}]}}]}}}
But now I want to iterate through the results/related tests.
I'm using advanced branching
and {{xrayTests.body.asJSON.data.getTestExecutions.results.first.tests.results}} as smart value.
xrayTests is a variable of {{webResponse.body}}.
But, this is not working, I get error
Hi @Dieter Lauwers
Welcome to the Atlassian Community!
The issue is likely that xrayTests contains {{webResponse.body}} as a string, so Automation can't navigate it as a JSON object. I would branch directly over the response instead.
{{webResponse.body.data.getTestExecutions.results.first.tests.results}}
Set the Advanced Branch variable to something like xrayTest.
Inside the branch you can then use
{{xrayTest.jira.key}}
{{xrayTest.jira.summary}}
If you need to keep xrayTests as a variable, convert it first using jsonStringToObject().
{{jsonStringToObject(xrayTests).data.getTestExecutions.results.first.tests.results}}
Regards,
Gor
Hi Gor,
I used {{jsonStringToObject(xrayTests).data.getTestExecutions.results.first.tests.results}} as smart value in branching. I now get error
advanced branching
09/02/2026, 15:16:41
Unable to render smart values when executing this flow:
Failed to convert string to JSON. Error: Unexpected character ('d' (code 100)): was expecting double-quote to start field name at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); line: 1, column: 2]: {data={getTestExecutions={results=[{issueId=188800, jira={key=TEST-13621}, tests={results=[{issueId=180163, jira={key=TEST-11939, summary=Add sales order, assignee=null}}, {issueId=180164, jira={key=TEST-11940, summary=Mandatory field validation, assignee=null}}]}}]}}}
xrayTests is a variable of {{webResponse.body}}.
Any tips?
Dieter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Your error names the exact spot, and the payload you pasted underneath it is the proof. It complains at line 1, column 2, expecting a double-quote to start a field name. Column 2 is where "data" begins, and your text has data= rather than "data":, so the parser is right to give up there.
That shape isn't JSON at all. Look at what the docs show for this function: "{{jsonStringToObject(webResponse.body)}} -> {value=Hello World!}", and immediately after, "Where the smart value for webResponse.body returned:" followed by {"value": "Hello World!"}. The braces-with-equals form is what comes OUT of the parse. The quoted form is what goes IN.
Your variable is holding the output shape and being fed back in as the input.
So the JSON was already gone before jsonStringToObject saw it. The function's own description is "Converts a JSON Formatted String into a JSON Object", and by the time your text reads {data={getTestExecutions=... it is no longer a JSON formatted string, it is the rendered form. Nothing parses that back.
Which makes Gor's first suggestion the one to take, and I don't think you tried it. Branch on {{webResponse.body.data.getTestExecutions.results.first.tests.results}} directly, with no variable in between, then use {{xrayTest.jira.key}} inside. I can't tell you from the docs exactly where it got rendered, only that by the time it reached the variable it already had.
If you do need it in a variable for something else later, store a leaf rather than the tree, so a single key or a joined list instead of the whole response. What you can't do is round-trip the object through text and expect to navigate it afterwards.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gabriela,
You are right, using {{webResponse.body.data.getTestExecutions.results.first.tests.results}} as smart value in the bracking works fine.
Thanks for help.
Dieter
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Dieter Lauwers
Gabriela is correct, the error occurs because once {{webResponse.body}} is stored in xrayTests, Automation renders it into a string representation such as {data={...}}, which is not valid JSON, so jsonStringToObject() cannot parse it back.
The clean solution is therefore to skip the intermediate variable and branch directly on: {{webResponse.body.data.getTestExecutions.results.first.tests.results}} Then, inside the Advanced Branch, using a variable such as xrayTest, you can access values with: {{xrayTest.jira.key}} {{xrayTest.jira.summary}}
Glad to hear the direct webResponse approach is working.
Regards,
Gor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.