android - Deserialize error with Jackson (png encoding) -


i have following string parse (string object) :

{   "langues" :      [         {"iso":"en", "id":1, "flag":[0,144,255,62,1,152,84,62,1,104,50,63,1,32,90,61,1,172,110,66,1,216,...]}         ,         {"iso":"fr", "id":2, "flag":[0,208,0,63,1,208,106,62,1,120,49,63,1,32,90,61,1,60,110,...]}         ,         { etc... }     ],     "when" : 133111... // timestamp } 

the flag array of byte png image

and following objects :

public class langues {     private long when;     private arraylist<langue> langues;      public long getwhen(){ return when; }     public void setwhen(long when) { this.when=when; }     ... }  public class langue {     private int id;     private string iso;     private byte[] flag;      // getters / setters } 

this throw me error :

objectmapper mapper = new objectmapper(); langues node = mapper.readvalue(mystring, langues.class); 

jsonparseexception

numeric value (144) out of range of java byte 

maybe byte[] not right container or can set jackson parser encoding somewhere ?

thanks in advance !!

[edit]

maybe editing each field of array of byte -128 have done kind of tricky , real waste of time...

i contacted codehaus mailing list , ended in no time ansistring instead of unicode or bytes, , voilĂ  !

{"langues":[{"iso":"zh","id":7,"flag":"ivborw0kggoaaaansuheugaaaiaaaabpcayaaady... 

with same simple code

objectmapper mapper = new objectmapper(); langues node = mapper.readvalue(mystring, langues.class); 

maybe editing each field of array of byte -128 have done kind of tricky , real waste of time...

i contacted codehaus mailing list , ended in no time ansistring instead of unicode or bytes, , voilĂ  !

{"langues":[{"iso":"zh","id":7,"flag":"ivborw0kggoaaaansuheugaaaiaaaabpcayaaady... 

with same simple code

objectmapper mapper = new objectmapper(); langues node = mapper.readvalue(mystring, langues.class); 

Comments

Popular posts from this blog

jasper reports - Fixed header in Excel using JasperReports -

python - ('The SQL contains 0 parameter markers, but 50 parameters were supplied', 'HY000') or TypeError: 'tuple' object is not callable -

delphi - How to convert bitmaps to video? -