- Boon 教程
- Boon - 主頁
- Boon - 概述
- Boon - 環境設定
- 解析 JSON
- Boon - 轉換為物件
- Boon - 轉換為對映
- Boon - 源
- 生成 JSON
- Boon - 從物件
- Boon - 從對映
- 日期處理
- Boon - Long 轉日期
- Boon - 字串轉日期
- Boon - 生成日期
- 註釋
- Boon - @JsonIgnore
- Boon - @JsonInclude
- Boon - @JsonViews
- Boon - @JsonProperty
- Boon 有用資源
- Boon - 快速指南
- Boon - 有用資源
- Boon - 討論
Boon - @JsonIgnore
@JsonIgnore 用於欄位級別,用於標記要忽略的屬性或屬性列表。
示例 - @JsonIgnore
以下示例適用於 @JsonIgnore −
import org.boon.json.JsonFactory;
import org.boon.json.ObjectMapper;
import org.boon.json.annotations.JsonIgnore;
public class BoonTester {
public static void main(String args[]) {
ObjectMapper mapper = JsonFactory.create();
Student student = new Student(1,11,"1ab","Mark");
String jsonString = mapper.writeValueAsString(student);
System.out.println(jsonString);
}
}
class Student {
public int id;
@JsonIgnore
public String systemId;
public int rollNo;
public String name;
Student(int id, int rollNo, String systemId, String name) {
this.id = id;
this.systemId = systemId;
this.rollNo = rollNo;
this.name = name;
}
}
輸出
您將看到以下輸出 −
{"id":1,"rollNo":11,"name":"Mark"}
廣告