Spring MVC : The request sent by the client was syntactically incorrect

后端 未结 6 522
一个人的身影
一个人的身影 2021-01-02 20:49

When sending JSON requests to the server, I\'m often greeted by this message:

The request sent by the client was syntactically incorrect ().

6条回答
  •  轮回少年
    2021-01-02 21:41

    If the data that your consuming is from an external api and if you want to shield your controller from unnecessary elements/properties that you dont need you can use below annotation on POJO class

    @JsonIgnoreProperties(ignoreUnknown = true) 
    

    or you could set it globally

    //jackson 2.0
    jsonObjectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    

提交回复
热议问题