gson.toJson () lança StackOverflowError
Eu gostaria de gerar uma string JSON do meu objeto: Gson gson = new Gson(); String json = gson.toJson(item); Sempre que tento fazer isso, recebo este erro: 14:46:40,236 ERROR [[BomItemToJSON]] Servlet.service() for servlet BomItemToJSON threw exception java.lang.StackOverflowError at com.google.gson.stream.JsonWriter.string(JsonWriter.java:473) at com.google.gson.stream.JsonWriter.writeDeferredName(JsonWriter.java:347) at com.google.gson.stream.JsonWriter.value(JsonWriter.java:440) at com.google.gson.internal.bind.TypeAdapters$7.write(TypeAdapters.java:235) at com.google.gson.internal.bind.TypeAdapters$7.write(TypeAdapters.java:220) at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68) at …