How to import JSON data with custom fields

Richard_Phelan December 29, 2017

I'm having a lot of trouble importing JSON data which needs to include values for custom fields. The ids and types of the custom fields are already defined, but the JSON import ignores them.

"issues": [
{
"key" : "TEST-1",
"summary" : "Summary text goes here",
"customfield_10082" : "Some text"
}
]

I know it's possible to add custom fields with this format

 "customFieldValues": [
                    //Custom Fields which accepts single values:
                        {
                            "fieldName": "My Awesome Text Field (single line)",
                            "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:textfield",
                            "value": "some text"
                        },

 But this creates completely new custom fields. It doesn't populate any that have already been defined.

3 answers

1 vote
Alexey Matveev
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.
December 29, 2017

Hello,

Try to add the custom field on the create and edit screen and have a look.

Richard_Phelan December 29, 2017

I had already done that.

Alexey Matveev
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.
December 29, 2017

What is the type of your custom field?

Richard_Phelan January 1, 2018

I have tried text and doubles. But it looks like the Json import is not capable of dealing with custom properties in the way I need. A bit of research has turned up reports from others who have hit the same snag.

However, the CSV import function is much more capable. I reworked my process around that and have found that I can do everything that I need to do.

Alex Chunilal June 22, 2020

Has this ever been fixed ?. I am trying to import a new issue via Json and the issue type is Epic, however, I cannot find a way to populate the custom field "Epic Name"

Christian Pavelka-Ulfendahl April 7, 2022

@Alex Chunilal I'm in the same situation as @Richard_Phelan was all those years ago, so I don't think this is fixed. The importer simply creates new fields, and I have not found any resouce on how to match the field on id instead of name, or in fact match it at all. My thought right now is to simply skip all the custom fields in the import, and instead add them via the API after creating the issues. Feels quite clunky, but might be worth a shot!

0 votes
Urs June 7, 2022

has anybody solved that problem ? I am in the same situation.

Fabian Duft June 7, 2022

Yes please see my comment below 

Urs June 7, 2022

Thanks for your answer. Yes, I have read your answer but it does not seem to work with Jira Cloud.

 

Following simple json file:

{
"projects": [
{
"key": "OFFER",
"issues": [
{
"issueType" : "Task",
"summary" : "Code Generierung (Sprints)",
"description" : "A description",
"customfield_10056" : "OP279"
}
]
}
]
}

 

The standard fields are imported but the custom field not. There is no error message or something special in the log.

Fabian Duft June 7, 2022

I have no experience with the cloud, but I guess you are importing the CF wrongly. 
You should do it in the following format:

"customFieldValues": [ { "fieldName": "Story Points", "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:float", "value": "15" }, { "fieldName": "Business Value", "fieldType": "com.atlassian.jira.plugin.system.customfieldtypes:float", "value": "34" } ] 
Like Urs likes this
Urs June 7, 2022

Thanks, Fabian. I thought that style would add an custom field every time. But it is updating the value. That is the solution...

0 votes
Fabian Duft May 20, 2022

I had the same problem.
Checking if the CF is only allowed in a certain context and if editing it is possible in the project solved the problem.
Jira then maps the values to the already existing CF.

Christian Pavelka-Ulfendahl May 20, 2022

Can I ask what version of Jira you're on? When I tested on Jira Server 8.1.1 (Software) it still created new CF:s.

Fabian Duft May 20, 2022

I tested it on Jira 8.20.8 (i)

Suggest an answer

Log in or Sign up to answer