Spring JSON request body not mapped to Java POJO

前端 未结 5 1029
终归单人心
终归单人心 2020-12-29 04:54

I\'m using Spring to implement a RESTful web service. One of the endpoints takes in a JSON string as request body and I wish to map it to a POJO. However, it seems right now

5条回答
  •  谎友^
    谎友^ (楼主)
    2020-12-29 05:35

    The formatting on this is terrible, but this should work for jackson configuration.

    
     
    
    
    
        
            
                
            
        
    
    

    ALso, as mentioned in a comment, your JSON is wrong for your object.

    {"firstname":"xyz",‌​"lastname":"XYZ"}
    

    does appear to be the correct JSON for your object.

提交回复
热议问题