12
I have a structure with circular references. And for debug purposes, I want to dump it. Basically as any format, but I chose JSON.
Since it can be any class, I chose GSON which doesn't needs JAXB annotations.
But GSON hits the circular references and recurses until StackOverflowError.
How can I limit GSON to
ignore certain class members? Both
@XmlTransientand@JsonIgnoreare not obeyed.ignore certain object graph paths? E.g. I could instruct GSON not to serialize
release.customFields.product.go to the depth of at most 2 levels?
Related: Gson.toJson gives StackOverFlowError, how to get proper json in this case? (public static class)