Layer7 API Management

 View Only

Policy Repository: Sanitize JSON Body of special characters 

Oct 15, 2018 09:00 AM

Sometimes it may be necessary to remove special, non alpha-numeric characters, from JSON values. This policy uses a combination of RegEx and JSON path expressions to accomplish this.

 

I.e:

{
"value": "This is a test message ' with special characters $30"
}

 

To use:


1) Open Policy Manager
2) Use an existing service or create a new service
3) Click the Import Policy button and browse to the sample policy

 

For testing/demo purposes the JSON payload is stored within a message variable,'payload'. This can be customized to another source (request / response) as needed.

Statistics
0 Favorited
5 Views
1 Files
0 Shares
1 Downloads
Attachment(s)
zip file
Sanitize JSON.xml.zip   1 KB   1 version
Uploaded - May 29, 2019

Tags and Keywords

Related Entries and Links

No Related Resource entered.