@JsonIgnoreProperties(ignoreUnknown = true)
public class TestResult {
private Map<String, String> datas;
>
......}
TestResult result= restTemplate.postForObject(AppConstants.URL +Secure/View/getTest",request, TestResult.class);
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): 17:08:27.570 pool-12-thread-1 An exception occured during request network execution :Could not read JSON: Can not deserialize instance of java.lang.String out of START_ARRAY token
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at [Source: libcore.net.http.ChunkedInputStream@41b46428; line: 1, column: 11] (through reference chain: model.vo.TestResult["datas"]); nested exception is org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at [Source: libcore.net.http.ChunkedInputStream@41b46428; line: 1, column: 11] (through reference chain: model.vo.TestResult["datas"])
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not deserialize instance of java.lang.String out of START_ARRAY token
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at [Source: libcore.net.http.ChunkedInputStream@41b46428; line: 1, column: 11] (through reference chain: model.vo.TestResult["datas"]); nested exception is org.codehaus.jackson.map.JsonMappingException: Can not deserialize instance of java.lang.String out of START_ARRAY token
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at [Source: libcore.net.http.ChunkedInputStream@41b46428; line: 1, column: 11] (through reference chain: model.vo.TestResult["datas"])
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at org.springframework.http.converter.json.MappingJacksonHttpMessageConverter.readInternal(MappingJacksonHttpMessageConverter.java:125)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at org.springframework.http.converter.AbstractHttpMessageConverter.read(AbstractHttpMessageConverter.java:147)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at org.springframework.web.client.HttpMessageConverterExtractor.extractData(HttpMessageConverterExtractor.java:76)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:484)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:439)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:317)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at service.TestRequest.loadDataFromNetwork(TestRequest.java:73)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at service.TestRequest.loadDataFromNetwork(TestRequest.java:1)
10-17 17:08:27.571: E//RequestProcessor.java:250(16865): at com.octo.android.robospice.request.CachedSpiceRequest.loadDataFromNetwork(CachedSpiceRequest.java:27)
检查原始响应,尝试在浏览器或rest客户机中点击该url以查看返回的内容。
无法读取JSON:无法从START_ARRAY标记反序列化java.lang.String实例
无法将java.lang.String实例反序列化出START_ARRAY标记链:model.vo.testresult[“datas”])
下面是POJO类: 主要功能如下:
我有一个JSON: 和DTO: 由于json对象中的数据字段实际上是一个对象,但在我的DTO中它是一个字符串,所以我得到了一个异常: 我可以做什么来成功执行这样的反序列化?
在客户端,我使用gson将JSON表示转换为java对象。然后,我将该对象传递给我的REST服务,它可以正常工作。 问题: 当我的JSON表示在集合中只有一个项时 客户端:
例外情况: 套接字处理程序 我相信当JSON被解析为WorkstationRequest对象时会出现异常,原因是下面的项。这是套接字处理程序: 我不知道如何开始调试它。堆栈跟踪从未触及我的应用程序。我正在使用部署我的.jar,并使用执行它
我收到下面的错误信息,请有人帮助或建议如何最好地调试这个。 我正在尝试从REst API调用反序列化Products对象。在我添加代码反序列化Price子类之前,代码一直运行良好。如下所示, 我的Price pojo如下所示, 我编写了一个Junit测试来尝试并模拟该错误,
我已经做了一个Lambda函数,我想通过URL在API网关的帮助下访问它。 我已经全部设置好了,我还在API网关中创建了一个主体映射模板,如下所示: 然后触发HTTP GET请求,如下所示: 这是完整的错误消息: