Jersey version: 2.13
JSON support: moxjersey-media-moxy y
JSON data:
{
"agentName": "myAgent",
"gameId": 2,
"id": 1,
"loginName": "admin",
"userAgentDetailList": [
{
"agentId": "agent_1"
},
{
"agentId": "agent_2"
},
{
"agentId": "agent_3"
}
]
}
UserAgent.java
@XmlRootElement
public class UserAgent implements Serializable {
private Integer id;
private String loginName;
private Integer gameId;
private String agentName;
List<UserAgentDetail> userAgentDetailList;
//setter,getter
}
UserAgentDetail.java
@XmlRootElement
public class UserAgentDetail implements Serializable {
private Integer id;
private Integer userAgentId;
private String agentId;
...
//setter,getter
}
UserAgentResource.java
@PUT
@Produces("application/json;charset=UTF-8")
@Consumes("application/json")
public String putUserAgent(UserAgent userAgent) {
logger.entry();
//do something...
logger.exit();
return "";
}
I found the useAgent is auto populated correctly,
but the nested List<UserAgentDetail> userAgentDetailList, could not be populated correctly, actually, the List is created, but the elements in the List are not created properly.
so, how to process the nested object?
thanks.