cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ilya Kramer (JIRA)" <j...@apache.org>
Subject [jira] Commented: (CXF-3341) Bad JSON marshalling of List<String> object
Date Wed, 16 Feb 2011 13:35:57 GMT

    [ https://issues.apache.org/jira/browse/CXF-3341?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12995291#comment-12995291
] 

Ilya Kramer commented on CXF-3341:
----------------------------------

Thank you for the quick response.

it's a shame you can't fix that, since I must not be the only newbie stumbling into this issue,
it's very noob unfriendly.

I also have to point out I tried my best to find a solution issue before submitting an issue
, using the keywords:
cxf java json array string 
produced no clue to this issue, you might want to give this issue a separate page to make
it easier to find

Thanks again

> Bad JSON marshalling of List<String> object
> -------------------------------------------
>
>                 Key: CXF-3341
>                 URL: https://issues.apache.org/jira/browse/CXF-3341
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.3.2
>         Environment: Ubuntu 10.04 64Bit Server
>            Reporter: Ilya Kramer
>
> Wrong result returned by marshalling an object with List<String>. The result some
why depends on the actual amount of elements on the list.
> for example , this code
> {code:title=LDTVSites.java|borderStyle=solid}
> package ldtv.api.models;
> import java.util.List;
> import javax.xml.bind.annotation.XmlElement;
> import javax.xml.bind.annotation.XmlRootElement;
> @XmlRootElement(name = "user")
> public class LDTVSites {
> 	
> 	private List<String> sites;
> 	public LDTVSites(List<String> sites) {
> 		setSites(sites);
> 	}
> 	public LDTVSites() {
> 	}
> 	public void setSites(List<String> listSites) {
> 		this.sites = listSites;
> 	}
> 	
> 	@XmlElement(name="sites")
> 	public List<String> getSites(){
> 		return sites;
> 	}
> }
> {code}
> if getSites returns a list with single result, the result of the function will be
> {code}
> {"user":{"sites":"string"}}
> {code}
> whereas if the result is two strings in the list , the output will be
> {code}
> {"user":{"sites":["string","string2"]}}
> {code}
> this makes some sense in XML , it shouldn't be so in JSON since the values of the two
expressions is different

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message