[英]How to get a Hash Map which is parsed to JSON?
I previously have a list which is parsed to JSON and received in the other end like this: 我以前有一个解析为JSON并在另一端收到的列表,如下所示:
List<Model> list = Arrays.asList(restTemplatelist.getForObject("http://dataurl, Model[].class));
Now I want the same method but this time I need a HashMap which is parsed to JSON and I have to receive as a HashMap. 现在,我需要相同的方法,但是这次我需要一个HashMap,它被解析为JSON,我必须以HashMap的形式接收。
Map<String, Object> combinedMap =restTemplatemap.getForObject("http://dataurl);
But this does not work.Any help is appreciated 但这是行不通的,不胜感激
Map <String, Object> combinedMap =restTemplatemap.getForObject("http://dataurl", Map.class);
请记住,返回的Map Object的值应该能够转换为您在CombinedMap类型中提到的Value Object
类型。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.