Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

How to deserialize array of objects in incoming webhook payload?


When trying to update an issue description via an incoming webhook using the project automation tools (/jira/software/c/projects/PROJECT-KEY/settings/automate), the JSON parser errors out when trying to parse a collection (an array of objects), assuming that the array bracket opens a 'regular' list / key-value-pair array.

So when the JSON object in the payload contains something like this:
    "collectionItems": [
            "property": "somevalue"
            "property": "someothervalue"

I get the following error (ignore line / column numbers):

Cannot deserialize instance of `java.lang.String` out of START_OBJECT token at [Source: (ByteArrayInputStream); line: 23, column: 9] (through reference chain: com.codebarrel.automation.api.webhook.IncomingWebhook["collectionItems"]->java.util.ArrayList[0])

Considering that I'm not able to modify the JSON payload, as it comes from another platform service, is there anything I can do to make this automation work?

1 answer

Hi @Willem Prins 

Without seeing your complete rule and the response structure, my recommendation is to use the text and list handing functions, conditional list filtering, and to progressively write pieces of the response to the audit log.  That may uncover if this is a problem identifying the structure in the response or an actual defect with parsing. 

Here are some references to help with those steps:

Kind regards,

Hi @Bill Sheboy 

Thanks for those links, it's good to know have these resources for working with smart values.

I created a new webhook to test my filtering options, and it seems the problem is that I cannot do perform any type of smartvalue handling because the payload as a whole is rejected when a parse error occurs. As soon as I replace the collection with a regular nested object, I can work with the payload.

So in my case, any curly bracket "{" that follows a "[" causes a parse error, which would be the case for any webhook where the body contains a collection of objects. Considering that this seems to be a pretty common and valid JSON construct, I'm surprised that this cannot be parsed:

From the spec:

> An array is an ordered collection of values [..] A value can be a string in double quotes, or a number, or true or false or null, or an object or an array. These structures can be nested.

Hi, Willem!

One more thing to try: save the response as a created variable to convert it to a string and then try to parse it, using text and list functions.

If that still doesn't work, I recommend working with your site admin to submit a ticket to Atlassian Support here:  They may see something else to help.  Once you hear back from them please post what you learn to benefit the community.  Thanks!

Hi Bill, thanks for staying with us here. Sadly, there's no way to get that response or save it to a variable because the automation errors out when it cannot parse the payload.

Thanks for the tip about contacting support though, I'll reach out to my admin and try and find answers there.

Luckily our amazing third-party service's engineers were able to offer an alternative approach which means we get webhook payloads without an array of objects, so we're not entirely stuck.

Like Bill Sheboy likes this

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira

Do you use Jira Cloud with Microsoft Teams?

Hi, Jira users! Do you use Jira alongside Microsoft Teams? We want to hear how you’ve used the power of Jira Cloud and Microsoft Teams (via the Jira Cloud for Microsoft Teams app) to achieve a team...

453 views 2 6
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you