- Boon Tutorial
- Boon - Home
- Boon - Overview
- Boon - Environment Setup
- Parsing JSON
- Boon - To Object
- Boon - To Map
- Boon - Sources
- Generating JSON
- Boon - From Object
- Boon - From Map
- Date Handling
- Boon - Long To Date
- Boon - String To Date
- Boon - Generating Date
- Annotations
- Boon - @JsonIgnore
- Boon - @JsonInclude
- Boon - @JsonViews
- Boon - @JsonProperty
- Boon Useful Resources
- Boon - Quick Guide
- Boon - Useful Resources
- Boon - Discussion
Boon - @JsonIgnore
@JsonIgnore is used at field level to mark a property or list of properties to be ignored.
Example - @JsonIgnore
Following example is for @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; } }
Output
You will see the following output −
{"id":1,"rollNo":11,"name":"Mark"}
Advertisements
To Continue Learning Please Login
Login with Google