JSFiddle - React, Tailwind, and code Playground

by John Wick

JavaScript

var data = [
  {
    "id": "97e6700c-4484-498f-bb8b-38dd1eef2cfa",
    "amount_initially_sent": "3.00",
    "offer_id": null
  },
  {
    "id": "192e5d9d-a449-4683-9444-fe532aaf3a6a",
    "amount_initially_sent": "4.00",
    "offer_id": "f5343ff4-5e3b-4ca4-a139-f844413da5d4"
  }
];

const newData = [];
for(i=0; i < data?.length; i++) {
  const newObj = Object.assign({}, data[i]);
	if (typeof(data[i].amount_initially_sent) === 'string' && data[i].amount_initially_sent) {
		newObj.amount_initially_sent = Number(data[i].amount_initially_sent);
	}
  newData.push(newObj);
}

console.log('newData:', newData);