Parsing JSON to List of Objects in Java -


i got json-object includes 2 objects of different classes in following form

{"field1":"value1","field2":"value2"...}{"f1":"v1","f2":"v2"...} 

in order retrieve both of initial objects, trying parse json sort of container , cast each one.

public void update(string jsonmap) throws jsonparseexception, jsonmappingexception, ioexception {     system.out.println(jsonmap);     list<object> list = mapper.readvalue(jsonmap, new typereference<list<object>>(){});     system.out.println("got list");     .... 

the jsonmap printed out above, second line executes without , output third line (sysout("got list")) , rest of method never executes.

should json-file formatted in different way in order map list or there better solution this?

any appreciated

that's not individual json object because contains multiple objects (as it's json-like)

{"field1":"value1","field2":"value2"...}{"f1":"v1","f2":"v2"...} 

this 2 objects. think if want parse using standard json parser you'll want use object structure like

{     'object1':     {"field1":"value1","field2":"value2"...},     'object2':     {"f1":"v1","f2":"v2"...} } 

Comments

Popular posts from this blog

javascript - JS causing window size to be bigger than necessary - Dropdown bug -

How to mention the localhost in android -

php - Calling a template part from a post -