Skip to main content
Participating Frequently
Aug 11, 2022 3:28 AM UTC
Question

Substitute function not working with commas

I have the following which i saved as a process variable of type text

{ "userId": "abc123", "submissionId": "111222333", "createdDt": "2022-06-17T04:07:19.611Z"}

I want to remove spacing between the commas and colons, trying to do so with substitute(pv!text, ": ", ":") and substitute(pv!text, ", ", ","). It works for the colon, but not for the comma, so the result is the following

{ "userId":"abc123", "submissionId":"111222333", "createdDt":"2022-06-17T04:07:19.611Z"}

Also, when i use stripwith(pv!text,","), the comma can be affected and removed. Wondering why substitute cant do the same.

Any ideas as to why this is happening or how else I can remove the space between the comma?

9 replies

Inspiring
Aug 11, 2022 4:53 AM UTC

Why you are using it as a string? any particular scenario?

zacha0002Author
Participating Frequently
Aug 11, 2022 5:00 AM UTC

i am receiving JSON through an API, and would like to format it and email it with the Send Email smart service

stefanhelzle0001
Brainy
Aug 11, 2022 6:21 AM UTC

Is there a reason to NOT use fromJson()? Then you would have an easy to navigate Appian dictionary.