dropwizard: incorrect json resulting from group of items -


i using dropwizard deliver restful service. json expect looks this:

{"featuredmerchants":     {"featuredmerchant":[         {"browseid":"v1_0_0_1112",             "merchantid":3902,             "priority":1,             "sourceid":"15"},         ...,         {"browseid":"v1_0_0_1112",             "merchantid":456,             "priority":4,             "sourceid":"15"}]}} 

but json getting this:

{"featuredmerchant":[     {"browseid":"v1_0_0_1112",         "merchantid":3902,         "priority":1,         "sourceid":"15"},     ...,     {"browseid":"v1_0_0_1112",         "merchantid":456,         "priority":4,         "sourceid":"15"}]} 

i have 2 classes. have apifeaturedmerchantgroup class contains list of apifeaturedmerchants.

@jsonrootname("featuredmerchants") public class apifeaturedmerchantgroup {     private list<apifeaturedmerchant> apifeaturedmerchants;      public apifeaturedmerchantgroup() {     }      @jsonproperty("featuredmerchant")     public list<apifeaturedmerchant> getapifeaturedmerchants() { return apifeaturedmerchants; }      public void setapifeaturedmerchants(list<apifeaturedmerchant> apifeaturedmerchants) { this.apifeaturedmerchants = apifeaturedmerchants; } }  @jsonrootname("featuredmerchant") public class apifeaturedmerchant {      private string browseid;     private int merchantid;     private integer priority;     private string sourceid;      public apifeaturedmerchant() {     }      public string getbrowseid() { return browseid; }     public void setbrowseid(string browseid) { this.browseid = browseid; }      public int getmerchantid() { return merchantid; }      public void setmerchantid(int merchantid) { this.merchantid = merchantid; }      public integer getpriority() { return priority; }      public void setpriority(integer priority) { this.priority = priority; }      public string getsourceid() { return sourceid; }      public void setsourceid(string sourceid) { this.sourceid = sourceid; } } 

how level json, "featuredmerchants" group contains individual "featuredmerchant" items? have wrong annotations, or missing one/some?

it's setting on objectmapperfactory:

objectmapperfactory objectmapperfactory = new objectmapperfactory(); objectmapperfactory.enable(serializationfeature.wrap_root_value); objectmapper = objectmapperfactory.build(); 

Comments

Popular posts from this blog

java - JavaFX 2 slider labelFormatter not being used -

Detect support for Shoutcast ICY MP3 without navigator.userAgent in Firefox? -

web - SVG not rendering properly in Firefox -