Integrate Spring RestAPIs with @JsonView

In the previous post, We had learned how to use @JsonView to serialize/de-serialize Java objects. Now we go to next step, JavaSampleApproach shows you how to integrate Spring RestAPIs with @JsonView to customize views and resolve infinity loop problem.

4. Implement RestAPIs

We implement a WebController which has 5 RestAPIs {‘/get/company’, ‘/get/product’, ‘/get/company/overalview’, ‘/get/company/detailview’, ‘/get/product/view’} and use @JsonView to customize returned views.