I’m making two API calls. The first returns JSON with one of the values being HTML as a string.
{ "html_content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0..." }
In the Tests section, I am setting a collection variable with this string.
pm.collectionVariables.set("htmlContent", pm.response.json().html_content)
Then, in the second API call, I am trying to POST the HTML string.
{ "html_content": "{{htmlContent}}" }
However, I’m getting a 400 because Postman is sending the string without the double quotes escaped, so the JSON is malformed.
{ "html_content": "<!DOCTYPE html PUBLIC "- //W3C//DTD XHTML 1.0... }
But if I simply copy the HTML output from the first API call and paste it into the second API call, it works (because the escaped double-quotes are still there).
So, my question is this: how do I instruct Postman to keep the escaping in place when I use the collection variable?