Forum Discussion

RyanHaas1's avatar
RyanHaas1
Qrew Member
4 years ago

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
------------------------------
  • try this


    var text jsonStripped = SearchAndReplace($json, "\\", "");

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------