I have found many articles about the circular reference with Gson, but I can\'t find an elegant solution.
As I know, some solutions is:
I am looking into this issue as well. Gson does not provide a default solution so far. What you can do is:
Option 1: Create an exclusion strategy which implements ExclusionStrategy to exclude the class and/or field in the circular reference;
Option 2: Use annotations to mark the field to be transient to avoid serialization;
Option 3: Create your own type adapter