I have 2 api calls Get and Post.
I am saving the value of Get using
var jsonData = JSON.parse(responseBody);
Value of ids is something like
In post i am sending the value of “ids” in body like below
however, the postman is removing the quotes and sending it as “abc,efg,asda12” and this is giving 404 not found error .
can someone please help me on how to send the data with quotes ?
Is that valid JSON?
It’s not an array (no square brackets) and is also not a single string.
Usually, you are talking about escape characters, but not sure how this would work. Postman will wrap quotes around it as it thinks it should be a single string element which is what it’s done.
Can you try the following and post the Console log?
thank you for your response. please find the console log below
(3) [“5cb4477d5db0434dbfd3466235152720”, “70c9ff9e1b2a4af6be42d7adc344b713”, “9296ea4f799d436db380c267f8ad94ff”]
Ok, so that is a flat array with three elements in. (You can see the square brackets).
To store and use these as variables you have to JSON.stringify() them before storing, and JSON.parse() them when you retrieve them.
array = ["5cb4477d5db0434dbfd3466235152720", "70c9ff9e1b2a4af6be42d7adc344b713", "9296ea4f799d436db380c267f8ad94ff"]
Otherwise it will store it like this…