After extracting data from an API, the format of the returned information looks like this:
[{"id":21},{"id":22},{"id":24}]
Next, I need to send this data to a database using a different API. However, the format for sending should be like this: [21,22,24]
. For example, the data received from the API is stored in a variable called valuesToSend
, which initially looks like this: [{"id":21},{"id":22},{"id":24}]
. But when it's being sent, it should be in the format [21,22,24]
.
postToDb(){
alert(this.valuesToSend)
}