java - Jackson - infinite loops deserializing -


i using jackson deserialize following json content:

{  "contacts": [     {       "localid": 45,       "serverid": 0,       "numbers": [         "1111",         "2222"       ]     },     {       "localid": 11,       "serverid": 0,       "numbers": [         "5555"       ]     }    ] } 

my java classes

public class contacts implements serializable {      private list<contact> contacts;      ... public getter , setter here  } 

and

@jsonserialize(using = contactserializer.class) public class contact implements serializable {      public long server_id;     public long local_id;     public list<string> numbers;       ... public getter , setter here } 

there no reference contact contacts. there additional attributes in contact not serialized on way server (request) , not send server (response). excluded them using @jsonignore. receive json mentioned above answer server. when deserializing there infinite loop , programm terminates. tried use deserializer contact, had same result. ended in infinite loop inside contact.

edit: method call app:

 objectmapper mapper = new objectmapper();  contacts c = mapper.readvalue(result.getresult(), contacts.class); 

edit: serializer

public class contactserializer extends stdserializer<contact> {      protected contactserializer() {         super(contact.class);     }      @requiresapi(api = build.version_codes.n)     @override     public void serialize(contact value, jsongenerator jgen, serializerprovider provider) throws ioexception, jsongenerationexception {          jgen.writestartobject();          jgen.writenumberfield(contact.column_local_id, value.getlocalid());         jgen.writenumberfield(contact.column_server_id, value.getserverid());         jgen.writeobjectfield(contact.column_numbers, value.getnumbers());          jgen.writeendobject();     } } 


Comments

Popular posts from this blog

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -