Hi Team,
I have a requirement that I am getting the data from external system in the form of list of string.
For Example headers: {"name", "Address"}, data: {{"Test 1", "Test2"}} I have to convert this data into list of dictionary like : {{name: "Test 1", Address: "Test2""}}
Since the field headers are also dynamic can you please help any functions or logic to convert the data into list of dictionary.
Thanks in Advance
Discussion posts and replies are publicly visible
You can use the below expression unless you have array of array in 'data' because Appian doesn't support list of list (array of array)
a!localVariables( local!doubleQuote: """", local!response: { headers: { "name", "Address" }, data: { { "Test 1", "Test2" } } }, local!headers: local!response.headers, local!data: local!response.data, a!fromJson( concat( "{", joinarray( a!forEach( items: local!headers, expression: concat( local!doubleQuote, fv!item, local!doubleQuote, ":", local!doubleQuote, local!data[fv!index], local!doubleQuote ) ), "," ), "}" ) ) )
Thanks Harshit the code is working as expected