title: MongoDB, Marshalling, JAXB and JSON
body: <p>So I am really confused, so hopefully what I am asking makes sense. I should note that this is for homework but I am just asking for help on a small part.</p>
  
  <p>Here are simplified and genericized versions of my data classes:</p>
  
  <pre><code>@XmlRootElement(name="item")
  @XmlType(propOrder={"name", "value"})
  public class Item {
  
      private String name;
      private int value;
  
      @XmlElement(name="name")    
      public String getName() {
          return name;
      }
  
      @XmlElement(name="value")   
      public int getValue() {
          return value;
      }
  
  }
  </code></pre>
  
  <p>and</p>
  
  <pre><code>@XmlRootElement(name="itemcontainer")
  @XmlType(propOrder={ "name", "items"})
  public class ItemContainer {
  
      private String name;
      private ArrayList&lt;Item&gt; items;
  
      @XmlElement(name="name")
      public String getName() {
          return name;
      }
  
      @XmlElement(name="items")
      public ArrayList&lt;Item&gt; getItem() {
          return item;
      }
  }
  </code></pre>
  
  <p>What I need to be able to do is convert ItemContainer objects back and forth between JSON to store in a MongoDB database. (Has to be MongoDB)</p>
  
  <p>From what I understand ArrayLists cannot be marshalled. </p>
  
  <p>What I am going to eventually need to do is read from a MongoDB database, unmarshall the JSON into Java objects, perform operations on these objects and then marshall them back into JSON to store in the database.</p>
  
  <p>What do I need to change or do to allow me to make conversions between JSON and ItemContainer?</p>