Q:

How to deserialize below json data into collection list using jackson?

{
    "TOTALRECORDCOUNT": 588,
    "RECORDCOUNT": 588,
    "HASMORE": false,
    "RECORDSET": {
        "COLUMNS": [
            "PARTNERSEGMENTID",
            "ORGANIZATIONID",
            "ORGANIZATIONNAME",
            "PROGRAMTRACK",
            "PARTNERLEVEL"
        ],
        "DATA": [
            [
                "Partner_Segment_GES",
                1,
                "Relayware",
                "ProgramTrack_SolutionPartner",
                "AuthorizedLevel"
            ],
            [
                "Partner_Segment_GES",
                2,
                "Tata Communications",
                "ProgramTrack_SolutionPartner",
                null
            ],

A:

You can use jackson @JsonRootName annotation as the json you have posted has only one top level key. If there are more you can create a pojo with recordSet being a field of that.

Case when json only has recordSet as the toplevel key:
Here is the code: Pojo for recordSet
@JsonRootName("RECORDSET")
class RecordSet{

   @JsonProperty("DATA")
   List<List<String>> data;

   @JsonProperty("COLUMNS")
   List<String> columns;

   //getter and setter
}

Code to deserialize json to RecordSet object
String jsonString="{ \"RECORDSET\": { \"COLUMNS\": [ \"MEMBERSHIPLEVEL\", \"PARTNERSEGMENTID\", \"ORGANIZATIONID\", \"ORGANIZATIONNAME\", \"PROGRAMTRACK\", \"CREATED\" ], \"DATA\": [ [ \"ProgramLevel_Premier\", \"Partner_Segment_GES\", 2, \"Tata Communications\", \"ProgramTrack_SolutionPartner\", \"2008-06-10T20:03:07Z\" ] ] } }";

        ObjectMapper mapper=new ObjectMapper();
        mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);

        RecordSet recordSet = mapper.readValue(jsonString, RecordSet.class);

       //The below two statements can be replaced with the logic that you want to operate on deserialized object
        System.out.println(recordSet.getColumns());
        System.out.println(recordSet.getData());

Case when totalRecordSetCount and other fields are part of top level json:
class Response{

   @JsonProperty("HASMORE")
   private boolean hasMore;

   @JsonProperty("RECORDCOUNT")
   private int recordCount;

   @JsonProperty("TOTALRECORDCOUNT")
   private int totalRecordCount;

   @JsonProperty("RECORDSET")
   RecordSet recordSet;

  //getter and setter
}

Take the RecordSet pojo from case#1
Code to deserialize:
  ObjectMapper mapper=new ObjectMapper();
            Response response = mapper.readValue(jsonString, Response.class);

            RecordSet recordSet = response.getRecordSet();

 //The below two statements can be replaced with the 
 //logic that you want to operate on deserialized object

            System.out.println(recordSet.getColumns());
            System.out.println(recordSet.getData());

