1
votes

I am trying to trim / from below payload.

payload: { "drive" : "Dev", "rootPath" : "/Devtest" }

Am trying below

numValue: payload.rootpath.numValue replace "/" with ""

but giving me error how can i achieve this?

expected output:

"Devtest"

1

1 Answers

1
votes

Please, try with the following DataWeave expression:

%dw 2.0
output application/json
---
payload.rootPath replace "/" with ""

Note that this expression will replace all occurences of /. So, if rootPath is /root/subdir, the result will be rootsubdir.