今天一个同事遇到了这个异常,记录一下。

异常信息如下:

org.springframework.http.converter.HttpMessageNotReadableException: JSON parse error: Cannot constrsterxml.jackson.databind.uct instance of `XXXX` (although at least one Creator exiceParam` (although at leists): no String-argument constructor/factory method to deserialize from String value ('{"XXX"}'); nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot construct instance of `XXX` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String e(AbstractJackson2HttpMesvalue ('{"XXX"}')

这个其实原因就是序列化Json了两次,按照这个思路来排查,比如前端JSON.stringfy处理一下参数,或者后端检查下是不是需要你传递Object的地方但是你传递了 JsonToString(Object)。