How to validate (using a specified schema) a JSON input by the user during a POST request using a specified schema (we have to validate the JSON data each time it is received through the POST request)? Also, how to actually extract data entered by the user from a post request? I did the following to extract data entered by the user:
@PostMapping("/all-configs")
public Animal createConfig( @RequestBody Animal ani) {
try {
System.out.println(ani);//output: net.company.sprinboot.model.Animal@110e19d9
System.out.println(ani.toString());//output: net.company.sprinboot.model.Animal@110e19d9
String str = ani.toString();
System.out.println(str);//output: net.company.sprinboot.model.Animal@110e19d9
}
How can I actually read the JSON data entered by the user in the post request?