cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Create Key Value Pair instead of List/Array

flavia_sarah
New Contributor II

image

Expression for Conversation.Text = $[โ€˜$ConversationPost.Textโ€™].toString().split(โ€œ|โ€).map((elem, index) => [elem])

Mapper Output:
image

The desired output is:
โ€œConversationPostโ€ : {
โ€œTextโ€: โ€œcomment #2 US142โ€,
โ€œTextโ€: โ€œcomment #1 US142โ€,
โ€œArtifactโ€ : โ€œ/hierarchicalrequirement/โ€ฆโ€
}

Not sure where did I go wrong.
Is there any possible way to achieve this output?

1 ACCEPTED SOLUTION

SpiroTaleski
Valued Contributor

Hi @flavia.sarah

Please find the attached simple pipeline:

SL_Community_1_2020_11_23.slp (5.0 KB)

Hope that the output from this pipeline, that I have attached is what you are trying to achieve.

Regards,
Spiro Taleski

View solution in original post

2 REPLIES 2

SpiroTaleski
Valued Contributor

Hi @flavia.sarah

Please find the attached simple pipeline:

SL_Community_1_2020_11_23.slp (5.0 KB)

Hope that the output from this pipeline, that I have attached is what you are trying to achieve.

Regards,
Spiro Taleski

cjhoward18
Employee
Employee

The map() function returns a list of values, the value you are returning, [elem] from the map call, is a list as well. So the resulting value will always be a list of lists with this expression. Also, I noticed your data has duplicate keys. Using the same key will override the previous value stored at that key text, so I would recommend using the unique keys like given in the example by @Spiro_Taleski