Skip to main content
Question

Replacing a quote in a string

  • September 16, 2021
  • 0 replies
  • 111 views

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
------------------------------
This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24
try this


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

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