How Can I Quickly Escape a String Value for JSON POST to Avoid Invalidity Due to Included Quotes?

This topic was automatically generated from Slack. You can find the original thread here.

this is probably a silly question… but how can I quickly escape a string value to POST it via JSON? ie, I have the expression “{{steps.gpt_intro.$return_value.choices[0].message.content}}” but the contents might include quotes (") which must be escaped or the JSON value would be invalid

JSON.stringify() did the job.