Boon Tutorial
Selected Reading
- Boon - Discussion
- Boon - Useful Resources
- Boon - Quick Guide
- Boon - @JsonProperty
- Boon - @JsonViews
- Boon - @JsonInclude
- Boon - @JsonIgnore
- Boon - Generating Date
- Boon - String To Date
- Boon - Long To Date
- Boon - From Map
- Boon - From Object
- Boon - Sources
- Boon - To Map
- Boon - To Object
- Boon - Environment Setup
- Boon - Overview
- Boon - Home
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
Boon - @JsonIgnore
Boon - @JsonIgnore
@JsonIgnore is used at field level to mark a property or pst 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; pubpc class BoonTester { pubpc 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 { pubpc int id; @JsonIgnore pubpc String systemId; pubpc int rollNo; pubpc 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