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

Is my JSON incorrectly formatted?

Edited

I am POST'ing the following data to our server's v2 API using Python's request library.

{
"fields": {
"customfield_10300": "8lbs 3oz",
"customfield_10315": {
"value": "Mississippi",
"child": "Harrison"
},
"project": {
"key": "BOD"
},
"issuetype": {
"name": "Task"
}
}
}

 

I get an error:

{
"customfield_10315": "Can not instantiate value of type [simple type, class com.atlassian.jira.issue.fields.rest.json.bean.CustomFieldOptionJsonBean] from JSON String; no single-String constructor/factory method (through reference chain: com.atalassianl.jira.issue.fields.rest.json.beans.CustomFieldOptionJsonBean[\"child\"])"
}


Is my JSON incorrectly formatted?
Where could I have gone to figure this out on my own? I unsuccessfully tried searching the documentation. I also tried googling a solution, but the results all seemed to indicate those people were double-encoding their JSON strings by accident, which I don't think I am doing.

2 answers

0 votes
Thomas Deiler Community Leader May 04, 2021

Dear @R. Simpson ,

updating custom fields can be tricky. what type of custom is customfield_10315? What's your REST endpoint?

So long

Thomas

Hi @R. Simpson  -- Welcome to the Atlassian Community!

I noted that your project field name is not enclosed in quotation marks.  Have you tried to add those?

Best regards,

Bill

Apologies:  that was a typo.

Gotcha, and thanks. A few more ideas:

You may want to check out the REST API call to create issue, which uses the ID values rather than the names for such JSON access.  I cannot tell what transaction you are calling to know if that is relevant:

https://docs.atlassian.com/software/jira/docs/api/REST/1000.824.0/#api/2/issue-createIssue

Next, to confirm you are accessing the correct smart values/field names, you could make a call to the REST API with an example issue to check.  Here's an explanation of that:

https://support.atlassian.com/jira-software-cloud/docs/find-the-smart-value-for-a-field/

Suggest an answer

Log in or Sign up to answer
TAGS

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