Ignore field in JSON response spring boot
What you will learn here about Spring boot
- Ignore field in JSON response spring boot
Ignore field in JSON response spring boot
Please follow the following steps to know how to ignore field in json response spring boot
1)Please create simple maven project
2)Add spring boot starter dependency in pom.xml which is shown below
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
3)Now please create User class and use @JsonIgnore on the top field which you want to ignore which is shown below
4)Now please create a restcontroller which will return all users which is shown below
5)Now please run your spring boot application
6)Now please go to browser and hit url localhost:8080/users which is shown below