- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-15-2023 11:12 PM
I have a scripted REST api and now I am trying to get the payload if it is a valid then I am able to get it as below
var payload = request.body.data;
But if third party system send invalid JSON to ServiceNow then how to capture that I have tried different ways but not able to get it.
Below is the example of invalid JSON but I am trying to get it.
{
"Data": {
"Name": "test",
"ID": "1500"
"description": "Test description"
}
}
Share any solution if it is possible to get in any way.
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 04:16 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 12:47 AM
Hi Pavan, do you want to log the payload? You can parse the JSON object, convert to string and then log.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 12:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 01:05 AM
Hi @Prabu Velayutha ,
I am trying for invalid json if it is a valid we can get it.
Not sure how to make it work or Invalid JSON if you see above JSON is invalid i am trying for that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2023 01:11 AM
Did you try Stringfy Request object from JSON?
Find the details in the link below
https://www.servicenow.com/community/developer-blog/json-parsing/ba-p/2279166