Re: Json response shows arrays as string when there are single value

2014-11-06 Thread Manula Chathurika Thantriwatte
Hi Udara, I think we can go to the option 1 you mentioned rather than moving to JacksonJaxbJsonProvide. IMO is better to move JacksonJaxbJsonProvide after M4. Thanks ! On Thu, Nov 6, 2014 at 11:25 PM, Udara Liyanage wrote: > Hi Manula, > > Not yet committed. I have tool two paths to resolve th

Re: Json response shows arrays as string when there are single value

2014-11-06 Thread Udara Liyanage
Hi Manula, Not yet committed. I have tool two paths to resolve this which I succeeded in both paths. 1) I added below variables to the cxf-servelet.xml as below cartridges startupOrders dependencies There I was able to get the expected outcome. How

Re: Json response shows arrays as string when there are single value

2014-11-06 Thread Manula Chathurika Thantriwatte
Hi Udara, Have you commit the changes. On Wed, Nov 5, 2014 at 8:16 PM, Udara Liyanage wrote: > Hi Nirmal, > > Yes I already changed some endpoints which seems to work fine. I will test > others and will update the thread. > > On Wed, Nov 5, 2014 at 8:08 PM, Nirmal Fernando > wrote: > >> >> >>

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Udara Liyanage
Hi Nirmal, Yes I already changed some endpoints which seems to work fine. I will test others and will update the thread. On Wed, Nov 5, 2014 at 8:08 PM, Nirmal Fernando wrote: > > > On Wed, Nov 5, 2014 at 3:31 PM, Udara Liyanage wrote: > >> Hi, >> >> It works when I changed the Json provider t

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Nirmal Fernando
On Wed, Nov 5, 2014 at 3:31 PM, Udara Liyanage wrote: > Hi, > > It works when I changed the Json provider to > org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider > > > class="org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider"> > Yes, this is what I meant. It's a limitation of the earlier libra

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Manula Chathurika Thantriwatte
Hi Udara, I have tried with the online JSON POJO converter [1] with the grouping json. I get the following bean class for ServiceGroupDefinition. Currently we have used list for cartridges, subGroups and staupOrders. I think this should be change to String array. WDYT ? public class ServiceGroupD

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Udara Liyanage
Hi, It works when I changed the Json provider to org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider If we are using the above provider we do not need to specify serializeAsArray for any property as we have now. In addition it automatically remove the root element. I pasted the existing J

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Manula Chathurika Thantriwatte
Hi Udara, I think the POJO conversion didn't happen correctly. That's why it didn't deserialize correctly. On Wed, Nov 5, 2014 at 7:41 PM, Udara Liyanage wrote: > Hi, > > You can find it [1]. Please note that other bean classes have public > variables which are set when converting to a pojo. Th

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Nirmal Fernando
May be we have to use element wrapper; @XmlElementWrapper(name="cartridges") http://blog.bdoughan.com/2010/09/jaxb-collection-properties.html On Wed, Nov 5, 2014 at 3:11 PM, Udara Liyanage wrote: > Hi, > > You can find it [1]. Please note that other bean classes have public > variables which ar

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Udara Liyanage
Hi, You can find it [1]. Please note that other bean classes have public variables which are set when converting to a pojo. This bean as private variables and public getters and setters. [1] https://github.com/apache/stratos/blob/docker-grouping-merge/components/org.apache.stratos.manager/src/mai

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Nirmal Fernando
Can you point to the relevant rest endpoint bean ? On Wed, Nov 5, 2014 at 2:52 PM, Udara Liyanage wrote: > Hi Nirmal, > > But it works in get deployment policy endpoint, so it can not be a > limitation ? > > curl -X GET -H "Content-Type: application/json" -d @'app-php-only.json' -k > -u admin:

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Udara Liyanage
Hi, When I add the name of the variable to the cxf-servlet.xml as serializeAsArray, now cartridges are shown as arrays. cartridges But we can't specify it for each variable. On Wed, Nov 5, 2014 at 6:35 PM, Udara Liyanage wrote: > Hi, > > When I execute the GET serviceGroup Stratos endpoint

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Udara Liyanage
Hi Nirmal, But it works in get deployment policy endpoint, so it can not be a limitation ? curl -X GET -H "Content-Type: application/json" -d @'app-php-only.json' -k -u admin:admin https://localhost:9443/stratos/admin/policy/deployment/economyDeploymentPolicy | python -m json.tool % Total

Re: Json response shows arrays as string when there are single value

2014-11-05 Thread Nirmal Fernando
I think this is a limitation of the JSON library. On Wed, Nov 5, 2014 at 2:05 PM, Udara Liyanage wrote: > Hi, > > When I execute the GET serviceGroup Stratos endpoint I get the folowing > output in two different groups. Please note cartridges text in bold. When > there are only one cartridge, i

Json response shows arrays as string when there are single value

2014-11-05 Thread Udara Liyanage
Hi, When I execute the GET serviceGroup Stratos endpoint I get the folowing output in two different groups. Please note cartridges text in bold. When there are only one cartridge, it shows as a String (output1), when there are multiple cartridges it is shown as an array (output2). But when I con