jersey中json对象结构响应中缺少对象

时间:2017-07-03 08:27:28

标签: java json serialization jersey-2.0

这是我的简化对象结构:

@xmlRootelement

ArticleList implements Serializable{

   //ArrayList of articles

}

Article implements Serializable
{

  User user;

  //ArrayList of bids

}

User implements Serializable
{

 //Properties

}


Bid implements Serializable
{

 //Properties


}

Funcion标题:

@GET
@Path("/article-search")
@Produces( MediaType.APPLICATION_JSON )
public ArticleList articleSearch() {

    //Function code here

}

我在泽西岛功能中返回ArticleList。在答案中,我检查对象是否存在元素。

问题在于,在响应中找不到对象的任何元素Bids

回应的例子:

{

    "articles":[
        {
            //Some Props. Here
            "user":{
                 //Some Props. Here
            }
            //Here list of bids is missing. It is verified that the list contains elements
        }
    ]

}

1 个答案:

答案 0 :(得分:0)

我需要在对象文章

中添加出价数组列表的geters和setter