为动态 json 键编写 java DTO 的最佳方法是什么

What is the best way to write java DTO for dynamic json keys

我正在编写一个基于 jax-rs 的 rest API,其中我的响应将包含动态 json 键。在 json 键下方的响应中,Tom、Harry 是动态的,并且可以有更多。编写 java DTO 来表示结构并能够拥有动态员工姓名的最佳方式是什么?

    "employee":{  
      "Tom":{  
         "id":"23974",
         "name":"Tom L",
         "jobRole":"Associate",
         "contact":{  
            "phone":"8889993332",
            "address":"some address"
         },
         "peers":[  
            "peer1",
            "peer2"
         ]
      },
      "Harry":{  
         "id":"34234",
         "name":"Harry S",
         "jobRole":"Associate",
         "contact":{  
            "phone":"3459993332",
            "address":"some address"
         },
         "peers":[  
            "peer1",
            "peer2"
         ]
      }
   }
}

我会推荐以下 class:

class EmployeeDetails {
      private Map<String, Employee> Employee;
}

class Employee {
     private Long id;
     private String name;
     private String jobRole;
     private Contact contact;
     private List<String> peers;
 }

 class Contact {
    private String phone;
    private String address;
  }