Deserialize JSON in Java by inferring/embedding object type -


i serializing map<string, object> json using jackson.

later when deserialize it, objects not of primitive type converted linkedhashmap's instead of class belonged to.

is there way deserialize json map nested objects of correct type?

use constructcollectiontype of typefactory arraylist collectionclass & pojo class second argument , read "list" value using objectmapper. this:

list<t> list; objectmapper om = new objectmapper(); typefactory t = typefactory.defaultinstance(); list = om.readvalue(json, t.constructcollectiontype(arraylist.class,pojo_clazz)); 

hope helps!


Comments

Popular posts from this blog

java - HTTP Status 500 - An exception occurred processing JSP page /second.jsp at line 15 -

php - Using str_replace to translate a MySQL Table in html -

SQL Server - MyCTE query based on 24 hour period (next day) -