I am loading data and then putting it in an input, the data that it enters goes under the name "Business Type" and I need to change that to "businessTypeId"
for example
actually I have
[{"URL":"http://www.restaurant.com","Business Type":1},{"URL":"http://www.hotel.com","Business Type":2}]
I would like to:
replace all
"Business Type"to"businessTypeId"[delete square brackets]add
""to id (id is the number in Business Type)
this is the espected result
{"url":"http://www.restaurant.com","businessTypeId":"1"},{"url":"http://www.hotel.com","businessTypeId":"2"}
this is my code
placesArray.push(JSON.stringify(results.data));
console.log(placesArray);
document.getElementById('places').value = placesArray;
placesArray contains the string that I would like to change
placesArray.push(JSON.stringify(results.data));, and what doesconsole.log(placesArray);log afterwards? As it is an array of string(s), it simply can not be what is shown as "actually I have".