【发布时间】:2014-12-02 12:48:53
【问题描述】:
我有 List Object。我要传递给 Gson 的那个列表。
Gson gson = new Gson();
String toJson = gson.toJson(userDetailFeedNotifierVoList);
System.out.println("Gson Object : " + toJson);
我在这里进入控制台:
[
{
"title": "Suman Mudiraj assigned you a to-do item named test todo in the Launch GALAXY activity.",
"time": "2014-10-08T10:51:07.095Z",
"url": "https://greenhouse.lotus.com/activities/service/html/mainpage#activitypage,0c7b1fb5-a87f-4112-9b7f-67ed6bd0233f,entry=634e9535-ba17-40da-a242-bd9caff6f17d",
"schedullarTime": 0
},
{
"title": "Suman Mudiraj assigned you a to-do item named test todo in the Launch GALAXY activity.",
"time": "2014-10-08T10:51:07.095Z",
"url": "https://greenhouse.lotus.com/activities/service/html/mainpage#activitypage,0c7b1fb5-a87f-4112-9b7f-67ed6bd0233f,entry=634e9535-ba17-40da-a242-bd9caff6f17d",
"schedullarTime": 0
}
]
我想在这里获取标题和网址。你能建议我吗?
【问题讨论】:
-
如果您想将它们从序列化过程中排除,您可以将该字段标记为瞬态或使用@Expose 注解。