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

asp.net mvc - Cannot display error message on Editor or EditorFor -

python - No exponential form of the z-axis in matplotlib-3D-plots -

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