49
Views
6
Comments
Replace "" in \"
Question

Hi,

In a server action (in ODC), I need to convert a Text like this:

{""title"":""Test Title"",""description"":""Test Description""}

In this

{\"title\":\"Test Title \",\"description\":\"Test Description \"}

This means replace double quotes in \". I tried with the Replace, including use Chr() funtion, but nothing works. Anyone can help?

Thanks!

2019-04-09 00-57-55
carl ruhle

Hi,

use the function replace, it has 3 parameters

1 the string to be replaced 

2 the string to search 

3 the string that will be used 

Ex: replace("abcdea","a","A"), the output will be AbcdeA

Hope it helps you, regards 

UserImage.jpg
Rui Sousa

@carl ruhle I know the function and I tried with that. The problem is because of the quotes, is not that simple. Here's a screenshot of the error:

2019-04-09 00-57-55
carl ruhle

@Rui Sousa ,

I didn't want to offend you, sorry if I did offend, my apologies.

could you try this please

replace(JSON,"""",""\"")

or

replace(JSON,'""','\"')  its a ' then "

Thanks

UserImage.jpg
Rui Sousa

No problem @carl ruhle, you didn't :)

That one it's not not valid also:

Thanks.

2023-04-16 15-25-31
Krishnanand Pathak

Hi Rui,

Try below expression
Replace(JSON,"""""","\""")

Output shown below:-


Regards,
Krishnanand Pathak

UserImage.jpg
Rui Sousa

Hi @Krishnanand Pathak, 

Using that replace, the JSON stays the same... I don't know if is because the operation is made in a Library (server action).

Thanks,

Rui Sousa

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.