How to include Special characters in JSOn payload, without disturbing the format
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 03:05 AM
I have a rest API integration in place when any change request created in Source will be created in Target instance as well when I put any value in Description field with special characters. for EX: " Creation of change " OR " change is created 12#"
The JSON rejects it as the "'s and # is corrupting the format, is there a way to solve this. in Business Rule.
Description: " test created#$"
Expected result in target instance: "test created#$"
- Labels:
-
Change Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 05:29 AM
Have you tried using setStringParameterNoEscape()?
Regards
Air

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 05:39 AM
I'm not finding a problem with JSON not being able to process hash character. Following script works OK. Please provide a concrete JSON string as well as script that's being used.
var json = '{"Description": "test created#$"}';
var obj = JSON.parse(json);
gs.print(obj.Description);
Result
test created#$
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-05-2020 06:17 AM
Hi anu
You are correct, encoding is required to escape these symbols (by that it will convert characters into a format that can be transmitted over the Internet). Hope it helps