I would like to convert each request to the following format before the request is sent.
"Store": {
"Tesco": "1284756",
"Sainsburys": "37384657",
"Asda": "1234567"
}
I believe that we can use something like JSON.stringify({"Store": {"Tesco": "1284756","Sainsburys": "37384657","Asda": "1234567"}}).replace(/[\"]/g, '\\\"');
to convert the string.
How can we use this in Karate to convert each request into the following format:
\"Store\": {\n\"Tesco\": \"1284756\",\n \"Sainsburys\": \"37384657\",\n \"Asda\": \"1234567\"\n}\n
I would also like to treat the response and revert it back to the following format?
"Store": {
"Tesco": "1284756",
"Sainsburys": "37384657",
"Asda": "1234567"
}