Closed ghost closed 6 years ago
That response is not JSON so it's not surprising it can't be unmarshalled using a JSON converter. What is this "embedded JSON" that you speak of? Where does it originate? Note that the SO link you pasted contains a question about unmarshalling actual JSON, so it doesn't look the same to me.
Thanks for the quick response! I already corrected the example JSON and the SO question link (isn't my question, is another guy question but in the same situation).
If you try to parse a JSON with a nested list of JSONs with the default RestTemplate configuration throws the exception:
Could not extract response: no suitable HttpMessageConverter found for response type
Works for me. Maybe you can post a sample app? Perhaps fork the actual consuming guide that you referred to and modify it?
It was a problem of the server API, the response has the wrong content-type. I'll close the issue, thanks!.
I'm currently working on a new spring based project and i had this problem again. It's very common (or for sure) consume APIs that the response looks like this:
{ id: 123, name: "foo", vehicles: [ { model: "sedan" }, { model: "truck" } ] }
In order to support the "vehicles" list attribute, you must define your RestTemplate Bean like this: `@Bean
There's a lot of questions (like this) in stackoverlow .
I really think that if you're writing a new app, probably you'll need to parse nested json and it's a problem if the Guide only provide the basic feature of plain jsons. If you think that it's a good idea, i can help with the new lines of the Guide.
Thanks! Regards, Fede.