Scripted RREST API payload need to get for invalid JSON

Pavan_Snow_1
Kilo Guru

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!

1 ACCEPTED SOLUTION

Pavan_Snow_1
Kilo Guru

I think we can't get the invalid JSON as payload on request.

 

View solution in original post

20 REPLIES 20

Hi @Prince Arora ,

That is not an acceptable solution but thought that it is helpful.