[Jersey] JSON / XML unmarshaller problem

From: Jairo1 <>
Date: Wed, 13 Apr 2011 06:50:41 -0700 (PDT)

I'm facing with the following issue:

I'm trying to unmarshal the JSON data received from web server using this

ClientResponse responseJ =
//Get the entity of the response
String textEntityJ = (String)responseJ.getEntity(String.class);

JSONJAXBContext contextJson = null;
JSONUnmarshaller unmarshallerJson = null;
MyClass myClassJson = null;

//built JSONConfiguration based on mapped notation
contextJson = new JSONJAXBContext(JSONConfiguration.natural().build(),
unmarshallerJson = contextJson.createJSONUnmarshaller();//create JSON

myClassJson = unmarshallerJson.unmarshalFromJSON(new
StringReader(textEntityJ), MyClass.class);

Even I get the data in the 'textEntityJ' in the format
{"version":["abb.123","xyz.456"]} the unmarshaller returns always MyClass
object with empty List ( myClassJson.getVersion().size = 0).

MyClass structure:

@XmlType(name = "", propOrder = {
@XmlRootElement(name = "versions")
public class MyClass {

protected List version;

public List getVersion() {
if (version == null) {
version = new ArrayList();
return this.version;


What could be wrong? The same issue I'm facing with XML approach. I receive
data (as String) in the XML format, but unmarshaller failes in case when
Java bean contains LIST object.

Thanks in advance for your help,

View this message in context:
Sent from the Jersey mailing list archive at