Thanks for posting your question in the Microsoft Q&A forum. May this model can help you to do dynamic assignment
function jsonToCsv(records) {
// CSV header (extract field names from the first record)
var header = Object.keys(records[0]).join(",");
var csv = header + "\n";
// Iterate over each record and add to CSV string
records.forEach(function(record) {
var values = Object.values(record).join(",");
csv += values + "\n";
});
return csv;
}
** Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful **