net.sf.json.JSONObject
String timelineContent=一个json Json.put("timelineContent",timelineContent);
此时框架会自动将String类型的timelineContent当Json put进去。。。
然后因为接口要求String不要JsonObject,就报
{"errorCode":-1,"errorMessage":"Internal Server Error","exceptionClassName":"org.springframework.http.converter.HttpMessageNotReadableException","exceptionMessage":"JSON parse error: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token; nested exception is com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of `java.lang.String` out of START_OBJECT token\n at [Source: (PushbackInputStream); line: 1, column: 397] (through reference chain: java.util.ArrayList[0]->com.homethy.persistence.domain.LeadTimeline[\"timelineContent\"])","exceptionTime":"2019-06-19 08:59:12"}
没找指定类型为String不做转换的方法
暂时解决办法
Json.put("timelineContent",timelineContent==null?null:" "+timelineContent);
然后接口方就能正确识别了。。。