How do I import a JSON-file with multiple values?

Johannes Buverud
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.
February 21, 2018

Example:

 

I have two object types

- "Certificate", with attribute "Store" (which have unlimitd cardinality since a certificate can be in multiple Certificate Stores.) 

- "Certificate Store"

 

 

I have created three Certificate Store objects: "Store1", "Store2" and "Store3"

 

 

I have a JSON file with two certificates "Cer1" and "Cer2" and their related stores. The first certificate has two related stores, the second has one :

Skjermbilde.JPG

 

 

When I create an import, I have to choose which of the three Data Locators containg the stores to be mapped to the refereed Certification Store:

Skjermbilde.JPG

Maybe I can select all of them in this example, but this will then not work when a new file needs to be imported with certificates containing more stores than two stores.

Does the JSON file has to be reformatted, and if so how? Or is there another way to do this?

2 answers

1 accepted

1 vote
Answer accepted
Alexander Sundström
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.
February 23, 2018

Hi Johannes,

The value need to be piped, like :

value = "Store1||Store2"

Even if arrays are valid JSON, the current implementation does not support importing from an array without specifying the element index, this is something that will change in the future, but the work around is to make value to a String instead, and separate each value using ||

Best Regards
Alexander 

Johannes Buverud
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.
February 23, 2018

Removing the brackets and replacing the comma with the pipes did it, thanks!

Johannes Buverud
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.
February 28, 2018

And one more thing (which you had in your example); the inverted commas between the values also has to be removed.

For the record, this is what works:

"#store":  {"value" : "Store1||Store2"} 

and also

"#store":  "Store1||Store2"

 

Michal July 6, 2018

I doesnt seem to work for me. Can You show me full JSON file which You import with Insight?

0 votes
Robert Hutze January 8, 2019

I doesnt seem to work for me. Can You show us full JSON file which You import with Insight? Pls add JSON source here as a comment. 

Thx

Robert

Johannes Buverud
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.
January 8, 2019

The actual file I import has sensitive data, but this is an example of the full format:

[
{
"name": "Cer1",
"Store": "Store1||Store2"
},
{
"name": "Cer2",
"Store": "Store1||Store2||Store3"
}
]

 The "Object Mapping (IQL)" for the Store attribute in the Import Job is like this:

"Stores" IN (${Store${0}})

(where "Stores" is the attribute containing the Stores I import.)

Like Robert Hutze likes this
Robert Hutze January 8, 2019

Thanks! Major new info is the mapping details ("Object Mapping (IQL)").

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events