Hi there,
I am exploring the JIRA automation platform to figure out its capabilities for future projects, integrating our HR software to pull data into JIRA automatically. I am however stuck trying to parse a JSON array of arbitrary that takes the form of
``` [ {ID: Value, ID2: value2}, {ID: Value, ID2: Value2} ] ```
As a JSON array, there is no field name for the array itself, so I am a bit tripped up figuring out how to access its data using smart values. The format of this JSON response cannot be changed.
I am attempting to use a for each loop using the smart value {{webResponse.body}}, however this has not worked. Logging the outcome of this for each loop, it just passes the entire JSON object without splitting it into multiple objects. I have attempted to use {{JSONStringtoObject(webResponse.body)}} which also did not work, and prevents the log action from returning anything readable.
I assume I'm missing something simple about how Jira Smart Values work here, especially since I am able to parse/iterate through the same JSON without issue in JavaScript, so any help would be appreciated, thank you!
Hi @Cord Corcese -- Welcome to the Atlassian Community!
Without seeing your entire rule and parsing of the message for context...
It appears the webResponse is plain text, and because the array does not have a name, the jsonStringToObject() function is not succeeding with the conversion.
You could try a couple of approaches:
Kind regards,
Bill
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.