Create
cancel
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

Combine two JSON Arrays to one

Hi,

I was wondering if I could get some help in combining two JSONArrays into one for a PUT request in my automation. I have fetched some data from my URL using a webhook. I have stored the JsonArray to a variable. I want to combine the fetched array with an issue field and update it using a new webhook URL.

 

I would like to:

{{webhookResponse.attendees}} combined with {{issue.email}}

The {{webhookResponse.attendees}} is a JsonArray and the  {{issue.email}} is a string to be added into the JsonArray

 

For Example:

Two Arrays.

[
  {
    "productcode":"IRECP",
    "FreeStock":"5",
    "ExpectedStock":""
  },
  {
    "productcode":"N10001",
    "FreeStock":"0",
    "ExpectedStock":""
    }
]

[
  {
    "productcode":"EK20",
    "FreeStock":"1.00",
    "ExpectedStock":"20.00"
  },
  {
    "productcode":"EL50",
    "FreeStock":"-8.00",
    "ExpectedStock":"299.00"
  }
]

 

Desired Result would be one array containing both arrays.

[
  {
    "productcode":"IRE10030CP",
    "FreeStock":"5",
    "ExpectedStock":""
  },
  {
    "productcode":"NIK10001",
    "FreeStock":"0",
    "ExpectedStock":""
    },

  {
    "productcode":"EK219SV150",
    "FreeStock":"1.00",
    "ExpectedStock":"20.00"
  },
  {
    "productcode":"ELTHMC50",
    "FreeStock":"-8.00",
    "ExpectedStock":"299.00"
  }
]

 

 

Thanks

1 answer

Hi @Blen Assefa  -- Welcome to the Atlassian Community!

I do not know of any built-in JSON array merging for automation, but I expect you could use the text (string) and list functions to perform the merge.  Please look here for more information:

Best regards,
Bill

Suggest an answer

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

⏰ Day in the life of a Jira Admin!

Hello Community! We thoroughly enjoyed this just-for-fun conversation in the Jira Admin Group about what it's like to be a Jira Admin. For #JiraJuly, our talented designers created these graphics t...

705 views 2 21
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