Skip to content
Advertisement

How to get List from Object in Spring RestTemplate

How to get List from Object? Below you can find my code:

JavaScript

Actually object variable is a List of Objects(Strings) and I need to get all these Strings.

If I print it out System.out.println(object.toString()); it looks like that:

JavaScript

I need to get List of these Strings to dynamic use it. Could you please help?

Advertisement

Answer

Try this out. This should work.

JavaScript

For simple cases the code above works, but when you have complex json structures which you want to map, then it is ideal to use ParameterizedTypeReference.

JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement