RyanHaas1
4 years agoQrew Member
Replacing a quote in a string
I have a use case where I have the following text in a field:
{\"line\":\"twenty"\}
The above is the output of the text field.
I need to replace the \ characters above - I'm looking to get the following output:
{"line":"twenty"}
So i need a search and repalce for just the \ above. The problem is this character is an escape character, and I have been fighting with searchandreplace to get this to work. Current iteration:
var text jsonStripped = SearchAndReplace($json, "\"", "");
This strips the quotes and the \ character making the output:
{line:twenty}
I need to keep the quotes, so the text is valid JSON. Any ideas?
------------------------------
Ryan Haas
------------------------------
{\"line\":\"twenty"\}
The above is the output of the text field.
I need to replace the \ characters above - I'm looking to get the following output:
{"line":"twenty"}
So i need a search and repalce for just the \ above. The problem is this character is an escape character, and I have been fighting with searchandreplace to get this to work. Current iteration:
var text jsonStripped = SearchAndReplace($json, "\"", "");
This strips the quotes and the \ character making the output:
{line:twenty}
I need to keep the quotes, so the text is valid JSON. Any ideas?
------------------------------
Ryan Haas
------------------------------