You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cxf.apache.org by Kannan Ramasamy <ra...@gmail.com> on 2011/02/14 17:43:30 UTC

Re: Support for Json arrays

Hi Sergey,

Is this issue fixed in Apache CXF 2.3.2? I am facing this issue presently in
my application.

When I try to post json array, I get a empty array after unmarshalling.
-- 
View this message in context: http://cxf.547215.n5.nabble.com/Support-for-Json-arrays-tp576369p3384717.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Support for Json arrays

Posted by Sergey Beryozkin <sb...@gmail.com>.
Forwarding to users list...

I've added a couple of tests and it is all working with Jettison
1.3-SNAPSHOT, embedded qualified and unqualified arrays are read properly, I
think using unqualified arrays was working before too, and Joerg's fix has
also contributed to qualified arrays being read properly

Cheers, Sergey

On Mon, Feb 14, 2011 at 5:10 PM, Kannan Ramasamy <ra...@gmail.com>wrote:

>
> Hi
>
> @XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
> @XmlRootElement(name = "store")
> public class Store {
>    private String description;
>    private Set<Image> images;
>    private Set<Keyword> keywords;
>
>    @XmlElement(name = "keyword")
>    @XmlElementWrapper(name = "keywords")
>    public Set<Keyword> getKeywords() {
>        return this.keywords;
>
>    }
>
>    @XmlElement(name = "image")
>    @XmlElementWrapper(name = "images")
>    public Set<Image> getImages() {
>        return images;
>    }
>
>
> }
>
>
> JSON INPUT
> ========
> {
>    "ns1.store": {
>        "ns1.description": "links offers a variety of office",
>        "ns1.images": {
>            "ns1.image": [
>                {
>                    "ns2.imageUri": "http:localhost:\10352.jpg",
>                    "ns2.height": 342,
>                    "ns2.type": "thumbnail",
>                    "ns2.width": 380
>                },
>                {
>                    "ns2.imageUri": "http:localhost:\10352.jpg",
>                    "ns2.height": 40,
>                    "ns2.type": "logoLarge",
>                    "ns2.width": 150
>                }
>            ]
>        },
>        "ns1.keywords": {
>            "ns1.keyword": {
>                "ns1.value": "34inks"
>            },
>            "ns1.keyword": {
>                "ns1.value": "35inks"
>            }
>        }
>    }
> }
>
>
> If i try to pass the above mentioned json data. I am getting as empty array
> after unmarshalling.
>
>
>
> --
> View this message in context:
> http://cxf.547215.n5.nabble.com/Support-for-Json-arrays-tp576369p3384766.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>

Re: Support for Json arrays

Posted by Kannan Ramasamy <ra...@gmail.com>.
Hi

@XmlAccessorType(XmlAccessType.PUBLIC_MEMBER)
@XmlRootElement(name = "store")
public class Store {
    private String description;    
    private Set<Image> images;
    private Set<Keyword> keywords;

    @XmlElement(name = "keyword")
    @XmlElementWrapper(name = "keywords")
    public Set<Keyword> getKeywords() {
        return this.keywords;

    }

    @XmlElement(name = "image")
    @XmlElementWrapper(name = "images")
    public Set<Image> getImages() {
        return images;
    }


}  


JSON INPUT
========
{
    "ns1.store": {
        "ns1.description": "links offers a variety of office",
        "ns1.images": {
            "ns1.image": [
                {
                    "ns2.imageUri": "http:localhost:\10352.jpg",
                    "ns2.height": 342,
                    "ns2.type": "thumbnail",
                    "ns2.width": 380 
                },
                {
                    "ns2.imageUri": "http:localhost:\10352.jpg",
                    "ns2.height": 40,
                    "ns2.type": "logoLarge",
                    "ns2.width": 150 
                } 
            ] 
        },
        "ns1.keywords": {
            "ns1.keyword": {
                "ns1.value": "34inks" 
            },
            "ns1.keyword": {
                "ns1.value": "35inks" 
            } 
        } 
    }
}


If i try to pass the above mentioned json data. I am getting as empty array
after unmarshalling. 



-- 
View this message in context: http://cxf.547215.n5.nabble.com/Support-for-Json-arrays-tp576369p3384766.html
Sent from the cxf-dev mailing list archive at Nabble.com.

Re: Support for Json arrays

Posted by Sergey Beryozkin <sb...@gmail.com>.
Hi

On Mon, Feb 14, 2011 at 4:43 PM, Kannan Ramasamy
<ra...@gmail.com> wrote:
>
> Hi Sergey,
>
> Is this issue fixed in Apache CXF 2.3.2? I am facing this issue presently in
> my application.

Do you mean reading into an explicitly declared array such as Book[],
in the resource method signature ?
>
> When I try to post json array, I get a empty array after unmarshalling.

Can you post an example please ?

Sergey

> --
> View this message in context: http://cxf.547215.n5.nabble.com/Support-for-Json-arrays-tp576369p3384717.html
> Sent from the cxf-dev mailing list archive at Nabble.com.
>