title: unmarshalling nested objects from json
body: <p>I have incoming JSON strings and I need to unmarshall into JAXB annotated objects.  I am using jettison to do this. JSON string looks like this: </p>
  
  <pre><code>{ 
    objectA : 
    { 
      "propertyOne" : "some val", 
      "propertyTwo" : "some other val",
      objectB : 
      {
        "propertyA" : "some val",
        "propertyB" : "true" 
      }
    }
  }
  </code></pre>
  
  <p>The ObjectA code looks like this:</p>
  
  <pre><code>@XmlRootElement
  @XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "objectA")
  public class ObjectA {
      @XmlElement(required = true)
      protected String propertyOne;
      @XmlElement(required = true)
      protected String propertyTwo;
      @XmlElement(required = true)
      protected ObjectB objectB;
  }
  </code></pre>
  
  <p>The ObjectB class code looks like this: </p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "objectB")
  public class ObjectB {
      @XmlElement(required = true)
      protected String propertyA;
      @XmlElement(required = true)
      protected boolean propertyB;
  }
  </code></pre>
  
  <p>The code used to unmarshall:  </p>
  
  <pre><code>JAXBContext jc = JAXBContext.newInstance(OnjectA.class);
  JSONObject obj = new JSONObject(theJsonString);
  Configuration config = new Configuration();
  
  MappedNamespaceConvention con = new MappedNamespaceConvention(config);
  XMLStreamReader xmlStreamReader = new MappedXMLStreamReader(obj,con);
  Unmarshaller unmarshaller = jc.createUnmarshaller();
  
  ObjectA obj = (ObjectA) unmarshaller.unmarshal(xmlStreamReader);
  </code></pre>
  
  <p>It doesn't throw any exceptions or warnings. What happens is that ObjectB is instantiated but none of its properties get their values set, i.e. propertyA is null and propertyB gets its default value of false.  I've been struggling to figure out why this doesn't work. Can someone help? </p>