|
Hello All, I am trying out Apache Wink and facing some issue with JSON serialization. I have an array attribute in JSON object. { "name" : "abc" , phonenos : [ "26641342" , "26543654", "65434321" ] } array shows square brackets '[ ]' when data has multiple elements in array. but if there is a single element in data array shows curly brackets '{ }' in JSON. { "name" : "abc" , phonenos : { "26641342" } } is there a way I can configure wink to always show square brackets? Thanks, Mallik |
|
Hi Mallik,
Hello All, I am trying out Apache Wink and facing some issue with JSON serialization. I have an array attribute in JSON object. { "name" : "abc" , phonenos : [ "26641342" , "26543654", "65434321" ] } array shows square brackets '[ ]' when data has multiple elements in array. but if there is a single element in data array shows curly brackets '{ }' in JSON. { "name" : "abc" , phonenos : { "26641342" } } is there a way I can configure wink to always show square brackets? Thanks, Mallik |
|
Hi Nick,
We are using jettison jars to serialize/deserialize data. (jettison-1.0.1.jar).. in below example phonenos is of type java.util.ArrayList . Thanks, Mallik From: Nicholas L Gallardo <[hidden email]> To: [hidden email] Date: 17/11/2009 19:52 Subject: Re: issue with single element in JSON array Hi Mallik, What API are you using to model/serialize your JSON data? In other words, what object type does your resource return? -Nick Nicholas Gallardo WebSphere - REST & WebServices Development [hidden email] Phone: 512-286-6258 Building: 903 / 5G-016 (Embedded image moved to file: pic18827.gif)Inactive hide details for Mallikarjun P Javali ---11/17/2009 08:03:00 AM---Hello All,Mallikarjun P Javali ---11/17/2009 08:03:00 AM---Hello All, Mallikarjun P Javali <mallikarjun@in .ibm.com> (Embedded image moved to file: pic15239.gif) To 11/17/2009 (Embedded image 08:12 AM moved to file: pic11211.gif) wink-user@incubato Please respond to r.apache.org [hidden email] (Embedded image moved to file: pic02843.gif) cc (Embedded image moved to file: pic16297.gif) (Embedded image moved to file: pic13172.gif) Subject (Embedded image moved to file: pic30983.gif) issue with single element in JSON array (Embedded image moved to file: pic06687.gif) (Embedded image moved to file: pic29908.gif) Hello All, I am trying out Apache Wink and facing some issue with JSON serialization. I have an array attribute in JSON object. { "name" : "abc" , phonenos : [ "26641342" , "26543654", "65434321" ] } array shows square brackets '[ ]' when data has multiple elements in array. but if there is a single element in data array shows curly brackets '{ }' in JSON. { "name" : "abc" , phonenos : { "26641342" } } is there a way I can configure wink to always show square brackets? Thanks, Mallik [attachment "pic21598.gif" deleted by Mallikarjun P Javali/India/IBM] |
|
Hi Malik,
I don't think this can be changed unless someone with the Jettison project can modify their code. I think you'll have to raise the issue with them (http://jettison.codehaus.org/). As an alternative, you can look into Jackson (http://jackson.codehaus.org/). On Wed, Nov 18, 2009 at 4:32 AM, Mallikarjun P Javali <[hidden email]> wrote: > Hi Nick, > We are using jettison jars to serialize/deserialize data. > (jettison-1.0.1.jar).. > in below example phonenos is of type java.util.ArrayList . > > Thanks, > Mallik > > > > > From: Nicholas L Gallardo <[hidden email]> > > To: [hidden email] > > Date: 17/11/2009 19:52 > > Subject: Re: issue with single element in JSON array > > > > > > > Hi Mallik, > > What API are you using to model/serialize your JSON data? In other words, > what object type does your resource return? > > -Nick > > > > Nicholas Gallardo > WebSphere - REST & WebServices Development > [hidden email] > Phone: 512-286-6258 > Building: 903 / 5G-016 > > (Embedded image moved to file: pic18827.gif)Inactive hide details for > Mallikarjun P Javali ---11/17/2009 08:03:00 AM---Hello All,Mallikarjun P > Javali ---11/17/2009 08:03:00 AM---Hello All, > > Mallikarjun P > Javali > <mallikarjun@in > .ibm.com> (Embedded image moved to file: > pic15239.gif) > To > 11/17/2009 (Embedded image > 08:12 AM moved to file: > pic11211.gif) > wink-user@incubato > Please respond to r.apache.org > [hidden email] (Embedded image moved to file: > pic02843.gif) > cc > (Embedded image > moved to file: > pic16297.gif) > (Embedded image moved to file: > pic13172.gif) > Subject > (Embedded image > moved to file: > pic30983.gif) > issue with single > element in JSON > array > > > (Embedded image moved to file: > pic06687.gif) > (Embedded image moved to > file: pic29908.gif) > > > > > > > > Hello All, > I am trying out Apache Wink and facing some issue with JSON serialization. > I have an array attribute in JSON object. > > { > "name" : "abc" , > phonenos : [ "26641342" , "26543654", "65434321" ] > } > > array shows square brackets '[ ]' when data has multiple elements in array. > but if there is a single element in data array shows curly brackets '{ }' > in JSON. > { > "name" : "abc" , > phonenos : { "26641342" } > } > > is there a way I can configure wink to always show square brackets? > > Thanks, > Mallik > > > > > [attachment "pic21598.gif" deleted by Mallikarjun P Javali/India/IBM] > |
| Powered by Nabble | See how NAML generates this page |
