Removal of backslash from string

0
How to remove \ (backslash) from a below string String : { \"Operation\" : { \"__Value\" : \"01\"} , \"WorkTeam\" : { \"__Value\"   : \"T-3010\"} , \"Priority\" : { \"__Value\" : \"1\"} , \"Status\" : { \"__Value\" : \"Not Ready\"} , \"Product\"}}
asked
6 answers
7

Hi Subham,

Try converting the JSON String to an object using Import mapping (https://docs.mendix.com/refguide/import-mappings/).

By this way you can remove the backslash in the string.

Hope it helps!!!

 

answered
4

You can use the replaceAll function to do this. For example, if your string is stored in a variable called $vData, you can use the following.
 

replaceAll($vData, '\\', '')

Note the double slash. This is because it’s an escape character so we need to escape it as well.

https://docs.mendix.com/refguide/string-function-calls/#13-replaceall

Hope this helps

answered
1

Like Robert said:

answered
0

 

Hi Eline Bijkerk, Please check microflow actions.

 

 

output : 

 

answered
0

Hi Shubham Mahajan, 

As Robert mentioned, if you need to avoid adding '\' or any characters reserved for JSON, you'll need to build a Java action using a JSON escape library.

answered
0

Hi, 

Try Sanitise the string before doing import mapping, you have community commons JA for the same. image.png

answered