Skip to content
Advertisement

Jackson read json in generic List

I’m using Jackson in order to read json messages. One of the values that I’ trying to parse is a List and another value contains the type of the data in the list. This is the structure i ‘ve created in java.

JavaScript

Through Class.forName(); I can get the class which represents the data in the list. The question is how can I read the List.

Advertisement

Answer

If you need to map the incoming json to your List you can do like this

JavaScript

Edit

Something like this, completly untested and never done

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