title: How to handle error of wrong JSON data in Java Rest Web Service: Jackson JSON Parser Unrecognized token
body: <p>this is my web service in which I am receiving JSON in student object.</p>
  
  <pre><code> @PUT
      @Path("/{stuId}")
      @Consumes({MediaType.APPLICATION_JSON})
      public Response update( @PathParam("stuId") UUID stuUUID , Student updatedStudentInfo) {
              return updateService.update(stuUUID, updatedStudentInfo);
          }
  </code></pre>
  
  <p>and this is the student class:</p>
  
  <pre><code>    public class Student{
  
        private int id;
        private String studentName;
        private String Address;
  
      @JsonProperty
       public int getId() {
          return id;
      }
      @JsonProperty
      public void setId(int id) {
          this.id = id;
      }
      @JsonProperty
      public String getStudentName() {
          return studentName;
      }
  
         .
         .
         .
         .
    }
  </code></pre>
  
  <p>It is working fine but I am not able to handle when scenario when I test it by sending erroneous JSON data. for example if I do it like this <br> <br>
  <strong>curl -v '<a href="https://localhost:9803/school/student/29374-345tr-44" rel="nofollow noreferrer">https://localhost:9803/school/student/29374-345tr-44</a>' -X PUT -H 'Accept: application/json, text/plain, /' -H 'My-API-Version: 1' -H 'Authorization: Basic' -H 'Content-Type: application/json;charset=utf-8' --data '{"studentName":"rock","Address":723868764}'</strong>
  <br><br> it geneartes an error:</p>
  
  <pre><code>Unrecognized token '723868764': was expecting ('true', 'false' or 'null')
  </code></pre>
  
  <p>Now how can I handle this situation that if some erroneous data comes then it should not send back any error or exception except the one which I want to send. 
  <br><br>
  <strong>EDIT 1:</strong>
  <br><br>
  Below we can also see the exception which is being generated by Java code</p>
  
  <pre><code> Caused by: com.fasterxml.jackson.core.JsonParseException: Unrecognized token 'sdfsdfdsfdsf': was expecting ('true', 'false' or 'null') at 
  [Source: org.glassfish.jersey.message.internal.ReaderInterceptorExecutor$UnCloseableInputStream@5c6d324d; line: 1, column: 59]
  </code></pre>