title: json rootelement is showing ArrayList instead of @JsonRootName("TestClass") as root element in JSON response
body: <p>I am working on maven SpringBoot microservice application where I expect json string with root element I which I have mentioned but it is giving me json string with ArrayList as rootelement. </p>
  
  <p>There are so many similar questions reported but none of the solutions is working for me.</p>
  
  <p>Expected is </p>
  
  <pre><code>{
      "TestClass": [
          {
              "itemId": "000023",
              "owner": "XYZ",
              "name": "BMW"
          },
          {
              "itemId": "000022",
              "owner": "PQR",
              "name": "GM"
          },
          {
              "itemId": "000021",
              "owner": "xyz",
              "name": "Ford"
          }
      ]
  }
  </code></pre>
  
  <p>Actual json response looks like</p>
  
  <pre><code>{
      "ArrayList": [
          {
              "itemId": "000023",
              "owner": "XYZ",
              "name": "BMW"
          },
          {
              "itemId": "000022",
              "owner": "PQR",
              "name": "GM"
          },
          {
              "itemId": "000021",
              "owner": "xyz",
              "name": "Ford"
          }
      ]
  }
  </code></pre>
  
  <p>POJO model class</p>
  
  <pre><code>import com.fasterxml.jackson.annotation.JsonRootName;
  
  @JsonRootName("TestClass")
  public class TestClass {
  
      private String itemId;
  
      private String owner;
  
      private String name;
  
      public String getName() {
          return name;
      }
  
      public void setName(String name) {
          this.name = name;
      }
  
      public String getItemId() {
          return itemId;
      }
  
      public void setItemId(String itemId) {
          this.itemId = itemId;
      }
  
      public String getOwner() {
          return owner;
      }
  
      public void setOwner(String owner) {
          this.owner = owner;
      }
  }
  
  
  package com.apps.partnerecosystem.rest;
  
  import java.util.ArrayList;
  import java.util.List;
  
  import javax.inject.Named;
  import javax.ws.rs.GET;
  import javax.ws.rs.Path;
  import javax.ws.rs.Produces;
  import javax.ws.rs.QueryParam;
  import javax.ws.rs.core.MediaType;
  
  import com.teamcenter.hello.Hello;
  
  @Named
  @Path("/")
  public class TestClassRest {
  
      private static List&lt;TestClass&gt; clients = new ArrayList&lt;TestClass&gt;();
  
      @GET
      @Produces(MediaType.APPLICATION_JSON)
      public List&lt;TestClass&gt; getClientes() {
          return clients;
      }
  
  
      @GET
      @Path("list")
      @Produces(MediaType.APPLICATION_JSON)
      public List&lt;TestClass&gt; getList() {
          List&lt;TestClass&gt; list = new ArrayList&lt;TestClass&gt;();
          TestClassitem1 = new TestClass();
          item1.setItemId("Test");
          item1.setOwner("deshpapr");
          item1.setName("Test");
          list.add(item1);
          list.add(item1);
          return list;
      }
  }
  </code></pre>
  
  <p>ApplicationConfig file</p>
  
  <pre><code>package com.apps.partnerecosystem.comappspartnerecosystem;
  
  import javax.inject.Named;
  
  import org.glassfish.jersey.server.ResourceConfig;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.http.converter.json.Jackson2ObjectMapperBuilder;
  
  import com.fasterxml.jackson.databind.DeserializationFeature;
  import com.fasterxml.jackson.databind.SerializationFeature;
  
  @Configuration
  public class ApplicationConfig {
  
      @Named
      static class JerseyConfig extends ResourceConfig {
          public JerseyConfig() {
              this.packages("com.apps.partnerecosystem.rest");
          }
      }
  
      @Bean
      public Jackson2ObjectMapperBuilder jacksonBuilder() {
          Jackson2ObjectMapperBuilder builder = new Jackson2ObjectMapperBuilder();
          builder.featuresToEnable(SerializationFeature.WRAP_ROOT_VALUE); // enables
                                                                          // wrapping
                                                                          // for
                                                                          // root
                                                                          // elements
         builder.featuresToEnable(DeserializationFeature.UNWRAP_ROOT_VALUE);
          return builder;
      }
      /*
       * public RestTemplate restTemplate() { RestTemplate restTemplate = new
       * RestTemplate(); restTemplate. return restTemplate; }
       */
  }
  </code></pre>