I’ve been banging my head against the wall trying to get the response correct for a module I’m building. The structure of the JSON data is unique in that it has headers in an array of objects and rows as a multi-dimensional array where the position of the data in each array corresponds with the headers by their position/order.
JSON
{
“DataSource”: {
“Id”: “99999”,
“Headers”: [
{
“Name”: “ID”,
“DisplayAt”: “None”
},
{
“Name”: “Unit Number”,
“DisplayAt”: “None”
},
{
“Name”: “Action”,
“DisplayAt”: “None”
}
],
“Rows”: [
[
“1”,
“12345”,
“Test”
],
[
“2”,
“54321”,
“Develop”
]
],
“TotalRows”: 2,
“LastUpdated”: “2024-02-25T18:44:02.1853900Z”
}
}
Expected Output:
{
“Rows”: [
[
“ID”: “1”,
“Unit Number”: “12345”,
“Action”: “Test”
],
[
“ID”: “2”,
“Unit Number”: “12345”,
“Action”: “Test”
]
}
My attempt at a response:
"response": {
"iterate": "{{body.DataSource.Rows}}",
"output": {
"Rows": "{{map(item; ''; join(map(body.DataSource.Headers.Name), ',') ) }}"
}
}