I have an API that expects specialities[] in the request body. The problem is that I don't know how to pass this as key in javascript.
This is what I'm doing:
const data = {
name: name,
phone: phone,
email: registerEmail,
pmc_number: pmcNumber,
speciality[]: speciality.split(","),
city: city
}
const {res} = await axios.post("api-url", data);
But, speciality[] gives syntax error. So, is there any way I can send the data to the API (the API can't be changed. I have to find the solution from the client side). Thanks.