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] Closed: (CXF-3341) Bad JSON marshalling of List<String> object
Date Wed, 16 Feb 2011 13:38:00 GMT

     [ https://issues.apache.org/jira/browse/CXF-3341?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Ilya Kramer closed CXF-3341.
----------------------------

    Resolution: Won't Fix

> 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