json - no root element name resteasy response -


i having trouble returning list of objects root name of object specified. i've tried several different things. sure doing incredibly stupid always, , appreciate help.

here object

@xmlrootelement @jsonrootname(value = "bixasset") @jsonignoreproperties({"hibernatelazyinitializer", "handler"}) @produces("application/json") @indexed     public class bixasset implements java.io.serializable {     @id     private uuid id;      private client client;      private string name;      private string asseturl;     private character active;     private integer width;     private integer height;     private string thumbnailurl;     private date createddate;     private string filetype;     private string category;       public bixasset() {     }      public bixasset(uuid id) {         this.id = id;     }      public bixasset(uuid id, client client, string name, string asseturl,character active, integer width, integer height, string thumbnailurl         ,date createddate, string filetype, string category) {         this.id = id;         this.client = client;         this.name = name;         this.asseturl = asseturl;         this.active = active;         this.width = width;         this.height = height;         this.thumbnailurl = thumbnailurl;         this.createddate = createddate;         this.filetype = filetype;         this.category = category;       }        public uuid getid() {         return this.id;     }      public void setid(uuid id) {         this.id = id;     }     @manytoone(fetch=fetchtype.lazy, cascade = { cascadetype.persist, cascadetype.remove })     @joincolumn(name="clientid")     public client getclient() {         return this.client;     }      public void setclient(client client) {         this.client = client;     }      public string getname() {         return name;     }      public void setname(string name) {         this.name = name;     }      public string getasseturl() {         return asseturl;     }      public void setasseturl(string asseturl) {         this.asseturl = asseturl;     }      public character getactive() {         return active;     }      public void setactive(character active) {         this.active = active;     }      public integer getwidth() {         return width;     }      public void setwidth(integer width) {         this.width = width;     }      public integer getheight() {         return height;     }      public void setheight(integer height) {         this.height = height;     }      public string getthumbnailurl() {         return thumbnailurl;     }      public void setthumbnailurl(string thumbnailurl) {         this.thumbnailurl = thumbnailurl;     }      public date getcreateddate() {         return createddate;     }      public void setcreateddate(date createddate) {         this.createddate = createddate;     }      public string getfiletype() {         return filetype;     }      public void setfiletype(string filetype) {         this.filetype = filetype;     }      public string getcategory() {         return category;     }      public void setcategory(string category) {         this.category = category;     }      } 

here method

@path("/bixasset/") @produces(mediatype.application_json) public response querybixasset(@queryparam("id") string id, @queryparam("filetype") string filetype, @queryparam("category") string category,   @queryparam("token") string token) {     try{          list<bixasset> results = new arraylist<bixasset>();            uuid clientid = dal.validatetoken(token);          if(token != null && clientid != null){                   string query ="from bixasset client.id = '" + clientid + "' ";                    if(id != null && !id.equals(""))                     query += " , id = '" + id + "'";                  if(filetype != null && !filetype.equals(""))                     query += " , filetype.id = '" + filetype + "'";                  if(category != null && !category.equals(""))                     query += " , category = '" + category + "'";                     query+= "  limit 1000";                 results = dal.query(query);                 system.out.println("query size" + results.size());           }else{             return response.status(401).build();         }           return response.ok(results).build();     }catch(exception e){         return response.status(400).build();     } } 

here result

   [   {     "id": "99f516a2-f7ef-4bc9-a627-73981a2fc3ae",     "client": {       "id": "388e16d6-d35e-4f8c-bba5-b1147b824473",       "reseller": null,       "name": "phizzle",       "createddate": 1357554435574,       "address1": "123",       "address2": "",       "city": "san francisco",       "state": "ca",       "postalcode": "80130",       "country": "usa",       "description": "phizzle master client"     },     "name": "gears_animated.gif",     "asseturl": "https://s3.amazonaws.com/asdad/99f516a2-f7ef-4bc9-a627-73981a2fc3ae.gif",     "active": "0",     "width": 141,     "height": 141,     "thumbnailurl": "https://s3.amazonaws.com/dadadsda/99f516a2-f7ef-4bc9-a627-73981a2fc3ae__thumbnail.jpg",     "createddate": 1380927929287,     "filetype": "image/gif",     "category": "images"   } ] 

would prefer result like

   {"bixasset" [   {     "id": "99f516a2-f7ef-4bc9-a627-73981a2fc3ae",     "client": {       "id": "388e16d6-d35e-4f8c-bba5-b1147b824473",       "reseller": null,       "name": "phizzle",       "createddate": 1357554435574,       "address1": "123",       "address2": "",       "city": "san francisco",       "state": "ca",       "postalcode": "80130",       "country": "usa",       "description": "phizzle master client"     },     "name": "gears_animated.gif",     "asseturl": "https://s3.amazonaws.com/adsdadd/99f516a2-f7ef-4bc9-a627-73981a2fc3ae.gif",     "active": "0",     "width": 141,     "height": 141,     "thumbnailurl": "https://s3.amazonaws.com/adadsd/99f516a2-f7ef-4bc9-a627-73981a2fc3ae__thumbnail.jpg",     "createddate": 1380927929287,     "filetype": "image/gif",     "category": "images"   } ] } 

have tried set annotation variable of @xmlrootelement instead of using @jsonrootname? mean:

@xmlrootelement(name = "bixasset") 

Comments

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -