Reputation: 443
We are getting a value from a DB that contains a backslash (\). After going through DataWeave, we get 2 backslashes. Here it is how it looks:
How can we have only one backslash in the end? Can we use the replace function somehow? I tried and could not make it work.
Upvotes: 1
Views: 10894
Reputation: 11
You could try to put in an escape character of your choice
Eg: %output application/csv escape = " "
This should ideally replace "/"
with " "
.
Hope this helps.
Upvotes: 1
Reputation: 266
I believe the reason why you see two backslashes is because backslash is a reserved character (see JSON spec) therefore DataWeave is automatically escaping the backslash, which is necessary so not to have your DB value corrupted.
In my opinion the double backslash is not a problem. You should get the right content upon consuming the JSON object.
Upvotes: 3