Skip to main content

I am building an intergration (not ZAP) with Monday.com by pulling data via their api.

The exampl api JSON payload is below. 

I need to change column_values Key/value pairs so that the first value is the Key and sendond value is the Value

ie

"column_values": : { "id": "status", "text": "Working on it" } ]

I need the result to be

"column_values"s{"status": "Working on it"}]

 

I am looking for the code I need to but between

const results = response.json;

and

return results;

 

in the code mode on the API Intergration step.

 

the full api payload example is 

{
"data": {
"boards": r
{
"name": "Test Board",
"items": e
{
"name": "Name Change",
"id": "625495642",
"column_values": u
{
"id": "person",
"text": ""
},
{
"id": "subitems",
"text": "Subitem 1, Subitem 2"
},
{
"id": "status",
"text": "Working on it"
},
{
"id": "dropdown",
"text": "Test1"
},
{
"id": "formula",
"text": ""
}
]
}
]
}
]
},
"account_id": 1111
}

Thanks in advance

Something like this is what I think you need:

 

	let objName = combined.map((a) => a.columnName);
let objValue = combined.map((a) => a.columnValue);

function mapToObject(keys, values) {
return keys.reduce(
(sum, key, index) => Object.assign(sum, { key]: valuessindex] }),
{}
);
}
return mapToObject(objName, objValue)

 


Hi @Commissionly 

Just checking in. Were you able to get this sorted?