https://grokonez.com/json/resolve-json-infinite-recursion-problems-working-jackson
How to resolve Json Infinite Recursion problem when working with Jackson
Json Infinite Recursion is one of the most common problems when we serialize Java objects which having Bidirectional-Relationships. So in the tutorial JavaSampleApproach will show you how to smoothly handle the problems with Jackson annotations: @JsonIgnore
, @JsonView
, {@JsonManagedReference
, @JsonBackReference
} and @JsonIdentityInfo
.
Related articles:
- Jackson to convert Java Object to/from Json String
- Integrate Spring RestAPIs with @JsonView
- How to use @JsonView to serialize/de-serialize and customize JSON format from Java Object
I. Infinite Recursion problem
We create 2 model classes: Company & Product have one-to-many relationship:
- Company:
public class Company {
private int id;
private String name;
private List products;
public Company(){
}
...
- Product
public class Product {
private int id;
private String name;
private Company company;
public Product(){
}
Serialize Java Objects with segment code:
More at:
https://grokonez.com/json/resolve-json-infinite-recursion-problems-working-jackson
How to resolve Json Infinite Recursion problem when working with Jackson
Top comments (0)