estoy usando Gson para generar ouput de depuración en mi solicitudvolcado objeto de cadena con Jackson
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
gson.toJson(myObject);
Pero Gson se queja acerca de un error de referencia circular al intentar serializar una estructura de datos. ¿Se puede hacer esto con la biblioteca de Jackson?
UPD Gson 2.3.1: Lanzamiento 20 Nov, 2014
Added support to serialize objects with self-referential fields. The self-referential field is set to null in JSON. Previous version of Gson threw a StackOverflowException on encountering any self-referential fields.
The most visible impact of this is that Gson can now serialize Throwable (Exception and Error)
el primer argumento de configure() método debería ser 'SerializationFeature.FAIL_ON_EMPTY_BEANS' actualmente . Su método serialize() debería tener 'throws JsonProcessingException' o try/catch block – kiedysktos