resttemplate getForObject map responsetype

Posted by Zack Macomber on Stack Overflow See other posts from Stack Overflow or by Zack Macomber
Published on 2014-06-13T15:21:28Z Indexed on 2014/06/13 15:24 UTC
Read the original article Hit count: 285

Filed under:
|
|
|

I'm invoking a rest service that returns JSON like this:

{
   "some.key" : "some value",
   "another.key" : "another value"
}

I would like to think that I can invoke this service with a java.util.Map as the response type but that's not working for me. I get this exception:

org.springframework.web.client.RestClientException: Could not extract response: no suitable HttpMessageConverter found for response type [interface java.util.Map]

Should I just specify String as the response type and convert the JSON to a Map?

© Stack Overflow or respective owner

Related posts about java

Related posts about JSON