Server error: Payload has to be numbers

Ok one more question since it seems to be causing me some grief right now. I am creating a del function which I need the payload to be a JSON object with ‘ids’: [123, 234, 456]. Is this possible I keep getting back from my endpoint that the id must be a number so how do I JSON.stringify a payload but keep the array numbers?

Code snippet:

let payload = JSON.stringify({
  'ids': data.allShifts
})

Yes, if data.allShifts contains an array of numbers, JSON.stringify() will produce an array of numbers. I suggest using console.log() to see what your script is doing, because this works as you’d expect:

import http from 'k6/http'

export default function () {
    let data = {
        allShifts: [123, 234, 456],
        // ...
    };
    let payload = JSON.stringify({
        ids: data.allShifts,
    });

    // This prints {"ids":[123,234,456]}
    console.log(payload);

    let response = http.post('https://httpbin.test.k6.io/anything', payload);
    // This shows that the data is correctly sent to the server
    console.log(response.body);
}