title: JSON serialization with root element does not work in RestEasy/Jettison/JBossAS7
body: <p>I am desperately looking for a way to make JSON serialization with root element to work on JBoss AS 7.1 with RestEasy and Jettison provider enabled.</p>
  
  <p>Although, according to RestEasy documentation, returning of the JSON root element should work, I never retrieve when requesting a REST servlet.</p>
  
  <p>I use an Object Factory:</p>
  
  <pre><code>@XmlRegistry
  public class ObjectFactory {
  
      private final static QName _NotificationList_QNAME = new QName("xxx:xxx:xxx", "notificationList");
  
     public NotificationList createNotificationList() {
          return new NotificationList();
      }
  
      @XmlElementDecl(namespace = "xxx:xxx:xxx", name = "notificationList")
      public JAXBElement&lt;NotificationList&gt; createNotificationList(NotificationList value) {
          return new JAXBElement&lt;NotificationList&gt;(_NotificationList_QNAME, NotificationList.class, null, value);
      }
  
  }
  </code></pre>
  
  <p>With the following XML object:</p>
  
  <pre><code>@XmlAccessorType(XmlAccessType.FIELD)
  @XmlType(name = "NotificationList", namespace = "xxx:xxx:xxx:xxx", propOrder = {
      "any"
  })
  @XmlRootElement (name = "notificationList" )
  public class NotificationList {
  
      @XmlAnyElement(lax = true)
      protected List&lt;Object&gt; any;
  
  
      @XmlElement (name="notificationList")
      public List&lt;Object&gt; getAny() {
          if (any == null) {
              any = new ArrayList&lt;Object&gt;();
          }
          return this.any;
      }
  }
  </code></pre>
  
  <p>I expect a notification list to be returned with root element "notificationList" but I don't get it. I use Jettison provider by default but also switched to Jackson. Both do not work for me. </p>
  
  <p>Maybe it is worth mentioning, the REST method is not returning the object itself but passes a AsynchronousResponse to another object which processes and eventually returen the JSON object bacck to I use AsynchronousResponse when creating the response  </p>
  
  <p>Edit:
  Some more info on the classes actually using NotificationList:</p>
  
  <p>The following REST class consumes a NotificationChannel class (not of interest here) and passes an Asynchronous Response obejct to another classe. This response object eventually returns the NotificationList. In a simplified way, as follows:</p>
  
  <pre><code>     @Path("/notificationchannel/v1")
              public class NotificationChannelService {
  
          @POST
          @Path("/{userid}/channels")
          @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
          @Mapped(namespaceMap = {
             @XmlNsMap(namespace = "XXXX:XXXX:XXXX:XXXX", jsonName = "notificationChannel")
                 })
  
          public void createNotificationChannel(
              final @Suspend(10000) AsynchronousResponse response,
              final JAXBElement&lt;NotificationChannel&gt; ncParam, 
              @PathParam("userid") String userID) {
  
  
              NotificationManager nMan = new NotificationManager(resp);
  
          }
   }
  </code></pre>
  
  <p>The response is created and returned as follows:</p>
  
  <pre><code>   public class NotificationManager {
  
        public NotificationManater(AsynchronousResponse resp){
  
        //dostuff
  
  
        notificationList = objectFatory.creatNotificationList();
  
        //add notification object (also defined int ObjectFactory)
         notificaitonList.addObject(messageNotification)
         notificaitonList.addObject(statusNotification)
         notificaitonList.addObject(inviteNotification)
  
         //dostuff
  
  
         resp.setResponse(Response.created(UriBuilder.fromUri(nc.getResourceURL()).build())
                          .entity(notificationList)
                          .type(MediaType.APPLICATION_JSON)
  
  
                      .build());
          }
       }
  </code></pre>
  
  <p>On client side, i expect the following response:</p>
  
  <pre><code>{"notificationList": {
      "inboundMessageNotification": {"inboundMessage": {
          "destinationAddress": "tel:+19585550100",
          "inboundMMSMessage": {"subject": "Who is RESTing on the beach?"},
          "link": {
              "href": "http://example.com/exampleAPI/v1/messaging/inbound/subscriptions/sub123",
              "rel": "Subscription"
          },
          "messageId": "msg123",
          "resourceURL": "http://example.com/exampleAPI/v1/messaging/inbound/registrations/reg123/messages/msg123      ",
          "senderAddress": "tel:+19585550101"
      }},
      "presenceNotification": {
          "callbackData": "1234",
          "link": {
              "href": "http://example.com/exampleAPI/v1/presence/tel%3A%2B19585550101/subscriptions/presenceSubscriptions/        tel%3A%2B19585550100/sub001",
              "rel": "PresenceSubscription"
          },
          "presence": {"person": {"mood": {"moodValue": "Happy"}}},
          "presentityUserId": "tel:+19585550100",
          "resourceStatus": "Active"
      }
  }} 
  </code></pre>
  
  <p>But i do get this (no RootElement name, no notification object name):</p>
  
  <pre><code>{
      {
          "destinationAddress": "tel:+19585550100",
          "inboundMMSMessage": {"subject": "Who is RESTing on the beach?"},
          "link": {
              "href": "http://example.com/exampleAPI/v1/messaging/inbound/subscriptions/sub123",
              "rel": "Subscription"
          },
          "messageId": "msg123",
          "resourceURL": "http://example.com/exampleAPI/v1/messaging/inbound/registrations/reg123/messages/msg123      ",
          "senderAddress": "tel:+19585550101"
      },
      {
          "callbackData": "1234",
          "link": {
              "href": "http://example.com/exampleAPI/v1/presence/tel%3A%2B19585550101/subscriptions/presenceSubscriptions/        tel%3A%2B19585550100/sub001",
              "rel": "PresenceSubscription"
          },
          "presence": {"person": {"mood": {"moodValue": "Happy"}}},
          "presentityUserId": "tel:+19585550100",
          "resourceStatus": "Active"
      }
  } 
  </code></pre>