title: JSON parsing using Jettison
body: <p>I am trying to parse JSON object using Jettison.
  This the code I'm using </p>
  
  <pre><code>String s ="{\"appUsage\":[{\"appName\":\"ANDROID\",\"totalUsers\":\"0\"},{\"appName\":\"IOS\",\"totalUsers\":\"4\"}]}";
  
  JSONObject obj = new JSONObject(s);
  
  ArrayList&lt;MiAppUsage&gt; l1 =  (ArrayList&lt;MiAppUsage&gt;) jsonParser(ArrayList.class, obj);
  
  public static Object jsonParser(Class c, JSONObject obj)
              throws JSONException, XMLStreamException, JAXBException {
          JAXBContext jc = JAXBContext.newInstance(c);
          Configuration config = new Configuration();
          MappedNamespaceConvention con = new MappedNamespaceConvention(config);
          XMLStreamReader xmlStreamReader = new MappedXMLStreamReader(obj, con);
  
          Unmarshaller unmarshaller = jc.createUnmarshaller();
          ArrayList&lt;MiAppUsage&gt;customer = (ArrayList&lt;MiAppUsage&gt;) unmarshaller.unmarshal(xmlStreamReader);
          return customer;
      }
  </code></pre>
  
  <p>I'm getting this error</p>
  
  <blockquote>
    <p>Exception in thread "main" javax.xml.bind.UnmarshalException
     - with linked exception: [javax.xml.bind.UnmarshalException: unexpected element (uri:"", local:"appUsage"). Expected elements are
    (none)]   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.handleStreamException(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(Unknown
    Source)   at com.json.UnmarshalDemo.jsonParser(UnmarshalDemo.java:56)
      at com.json.UnmarshalDemo.main(UnmarshalDemo.java:33) Caused by:
    javax.xml.bind.UnmarshalException: unexpected element (uri:"",
    local:"appUsage"). Expected elements are (none)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportError(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext$DefaultRootLoader.childElement(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.InterningXmlVisitor.startElement(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(Unknown
    Source)   at
    com.sun.xml.internal.bind.v2.runtime.unmarshaller.StAXStreamConnector.bridge(Unknown
    Source)   ... 4 more Caused by: javax.xml.bind.UnmarshalException:
    unexpected element (uri:"", local:"appUsage"). Expected elements are
    (none)    ... 14 more</p>
  </blockquote>
  
  <p>How to resolve this problem</p>