JSFiddle - React, Tailwind, and code Playground

JavaScript

function transform() {

	//define and run in transformer section of query
  let columnDefs = [{
    position: 0,
    name: "columnA"
  }, {
    position: 1,
    name: "columnB"
  }];
  
  // Dependent on how your API returns data
  let apiData = [
    ["Manny", 24, "Tulsa"],
    ["Moe", 45, "Philly"],
    ["Mack", 51, "NYC"]
  ];
  
  let newData = apiData.map(function(x) {
    let row = {};
    // logging statements for easy debugging
    console.log(columnDefs[0].name);
    console.log(x[0]);
    // you can parameterize this in a for loop if you feel like it
    row[columnDefs[0].name] = x[0];
    row[columnDefs[1].name] = x[1];
    row[columnDefs[2].name] = x[2];
    console.log(row); 
    return row;
  });
  return newData;
}
console.log(transform());