I have an email signature in the db that is in html format. I am trying to convert it to valid JSON and send it the the front end but I cannot for the life of me get it to replace " s with ".
I have tried every GPT under the sun and no matter what changes I make make seems not to be able to replace it.
Here is the expression I have in a set variable module at the moment:
Escaping strings before mapping into another JSON string
Most of the time, you cannot directly map variables containing text content into another JSON string without escaping them, as the variable might contain special characters that are reserved. Special characters in JSON needs to be escaped (encoded) as a “literal” character, otherwise they make the whole JSON invalid when you map the variable value when creating another JSON string.
You can escape string variables by passing the text into the “Transform to JSON” module. You can also build a valid JSON string by using a Data Structure with the “Create JSON” module. Then, you can map the output of the Transform module into another JSON string, or simply use the whole output of the Create module.
Note:
When using the “Transform to JSON” module on a string type variable, the output should already contain the double quotes " " around your text, so when you map this output into your JSON, you should not need to wrap another pair of double quotes around it.
Alternatively, you can use the built-in function replace to replace those special characters with their escaped versions. To do this, simply paste this into the field, and replace the 1.text variable: