Creating Projects via JSON Import
Asked by Josh Janusch:

I'm trying to build a tool that will export our Redmine data and process it into a format that can then be easily imported into Jira. I've built the script for exporting the Redmine data we need and now I'm just trying to figure out the import format Jira requires. The [JSON documentation](https://support.atlassian.com/jira-cloud-administration/docs/import-data-from-json/) is sparse and outdated, to say the least. I've worked through a few problems (like requiring undocumented \`template\` and \`type\` fields), but I cannot figure out how to create projects when importing.

I am working with a slightly modified example from the documentation:

```
{
  "projects": [
    {
      "name": "Sample data",
      "key": "SAM",
      "type": "business",
      "template": "Project management",
      "issues": [
       {
          "key" : "SAM-123",
          "status" : "To Do",
          "summary" : "Parent case",
          "externalId": "123"
        }
      ]
    }
  ]
}
```

When I go to Settings -\> System -\> External System Import -\> JSON and import that file, it presents me with this error:
> Unexpected failure occurred. Importer will stop immediately. Data may be in an unstable state: Unable to create project: ExternalProject{id='null', key='SAM', externalName='null', name='Sample data', type='business', template='Project management'}: Invalid module key specified:

If I change the \`key\` field to a project key that already exists, it imports without issue so that seems to imply that I can't use a project whose Project Key does not already exist even though the docs seem to imply otherwise (emphasis mine):
> You can assign a key to both the project and the issue. These keys can be different. **This example will create a project** with one issue, "SAM-123".

What am I doing wrong when trying to create these projects? We intend to import between tickets to around 300 projects, so being able to automatically create these will be crucial.


Answers:
author: Josh Janusch
body: After a bunch of trial and error to figure out all the kinks of my import process and a lot of changes to the process, I decided against importing the projects via CSV or JSON and instead create them via the [Cloud API](https://developer.atlassian.com/cloud/jira/platform/rest/v3), which is pretty well documented and features a lot of additional features the CSV and JSON importers are missing.

I recommend anyone who sees this post to skip the trying to do it via CSV or JSON and instead spend a few hours building out a script to do it via the API. You'll save time in the long run.


author: Josh Janusch
body: I still have not figured out how to create projects via the JSON importer, but I have figured out a workaround that I think I will proceed with. Basically I do a two step process:

1. Import Projects via the CSV importer
2. Import Issues to those Projects via JSON importer

I discovered that I can import projects very easily just using this CSV:

```
Name,Summary,Key,Type
Imported Project 1,Imported 2021-07-02,IP1,business
Imported Project 2,Imported 2021-07-02,IP2,business
```

That will create two different projects, each with an "Imported 2021-07-02" ticket that I can then do a mass search/delete for. If I then import the below JSON:

```
{
? "projects": [
????? {
? ?? ?? "name": "Imported Project 1",
?? ???? "key": "IP1",
??????? "type": "business",
??? ? ? "template": "Project management",
? ?? ?? "issues": [
?? ?????? {
????????? "key" : "IP1-123",
????? ? ? "status" : "Open",
??? ?? ?? "summary" : "Parent case",
? ?? ???? "externalId": "43829"
?? ???? },
??????? {
??? ?? ?? "key" : "IP1-456",
? ?? ???? "status" : "Open",
?? ?????? "summary" : "Another Ticket",
????????? "externalId": "5239"
??????? }
????? ]
??? }
? ]
}
```

It correctly imports 2 tickets into the IP1 project created by the CSV importer

comments: author: Cristiano
body: Hey [@Josh Janusch](/t5/user/viewprofilepage/user-id/4460050), hope you are doing well!

It seems that team-managed did not work very well with JSON import. However, apart from that, if you need to perform create a company-managed project, it should work with the JSON below:

```
{    "projects":    [        {            "name": "Project_name",            "key": "PK",            "type": "software",            "simplified": false,            "style": "classic"        }    ]}
```

Can you give it a try and let me know how it goes?

Looking forward to your response.

Cheers,   
Chris


author: Josh Janusch
body: Hi Cristiano. This ticket is over a year old and I marked [a self-response](https://community.atlassian.com/t5/Jira-Work-Management-Questions/Re-Creating-Projects-via-JSON-Import/qaq-p/1751495/comment-id/639#M639) as the answer. I ran the full import back in September of last year using the API instead and it ran fine.


author: Cristiano
body: Hi Josh,

Great! I've updated it here in order to help you and other folks that might try to find this solution. :)

Glad to know that you were able to make this workaround!

Have a nice day!

Cheers,

Chris


Tags: cloud

import

json