We need to sanitize a Json which is received as Java Object as shown in the below example
@Path("/agent”)
@POST
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response addAgent(Agent agent) throws Exception {}
We used JsonSanitizer for the purpose. However, JsonSanitizer accepts only String, so I had to convert my agent object to Json String, sanitize it and then convert back to agent object.
Is there an equivalent API which can sanitize Java Object directly without requiring the intermediate String conversion or any better approach than the one we took
Have asked the same query on stackOverflow
https://stackoverflow.com/questions/51402135/using-jsonsanitizer-for-java-objects