Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Passing multiple components in JSON Object

Hey there,

I use the ConfiForm makro in Confluence to generate a Jira Issue.

In the Macro body I defined the Object with JSON. 

But I somehow cannot pass multiple components to create the Jira Ticket... anyone has a clue what is the correct syntax / where my mistake is? I tried out multiple syntaxes but none worked so far...

The code below is my latest try.

 

 

{
"fields": {
"project": {
"id": "XXXX"
},
"summary": "Summary1",
"description": "Description1",
"issuetype": {
"id": "XXXX"
},
"components": {
"name": [
"Component1",
"Component2"
]
},
"labels": [
"Label1",
"Label2"
]
}
}  

1 answer

0 votes
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 17, 2023

Hi @Maximilian Herbert 

According to Jira documentation it goes like this

"components": [
{ "name": "Component1" },
{ "name": "Component2" }
],

Alex

Hi Alex,

 

that was one of my very first tries..
But this error occures:

  • Could not prepare JSON (Expected a ',' or '}' at 316 [character 2 line 14]): '{ "fields": { "project": { "id": "XXXX" }, "summary": "XXXX", "description": "XXX", "issuetype": { "id": "XXX" }, "components": [ { "name": "Component1" "name": "Component2" } ], } }'
Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 17, 2023

Please have a look more carefully at what I have suggested to do and your "error"

Like Bill Sheboy likes this

That exactly is the thing:
The JSON code which generates this error looks like that:


{ "fields": { "project": { "id": "XXXX" }, "summary": "XXXX", "description": "XXX", "issuetype": { "id": "XXX" }, "components": [ { "name":"Component1" }, { "name":"Component2" } ], "labels": [ "Label1", "Label2" ] } }

 

So basically it is the same code as you commented.. I dont know why there are missing brackets in the error....

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 17, 2023

Does it shows the same error about the broken JSON?

Nope. My latest code generates the broken JSON error and yours leads to the could not prepare json code....

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 17, 2023

This is a perfectly valid JSON

{ "fields": { "project": { "id": "XXXX" }, "summary": "XXXX", "description": "XXX", "issuetype": { "id": "XXX" }, "components": [ { "name":"Component1" }, { "name":"Component2" } ], "labels": [ "Label1", "Label2" ] } }

Could you share the actual configuration - page storage format? 

Bill Sheboy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
Oct 17, 2023

Hi @Maximilian Herbert 

Adding to Alex's answer...

Here is the documentation reference to check: https://confluence.atlassian.com/automation/advanced-field-editing-using-json-993924663.html

And, please check for any stray / trailing commas.  In your post about "one of my first tries" there is definitely a stray comma.

Kind regards,
Bill

Suggest an answer

Log in or Sign up to answer