Używam Gson wygenerować debugowania Ouput w mojej aplikacjiwysypisko obiekt String z Jackson
Gson gson = new GsonBuilder().setPrettyPrinting().serializeNulls().create();
gson.toJson(myObject);
Ale Gson nie narzekają okrągłym błędu podczas próby odniesienia do serializacji strukturę danych. Czy można to zrobić z biblioteką Jacksona?
UPD Gson 2.3.1: Wydany lis 20, 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)
pierwszy argument configure() metoda powinna być 'SerializationFeature.FAIL_ON_EMPTY_BEANS' obecnie . Twoja metoda serialize() powinna mieć 'throws JsonProcessingException' lub try/catch block – kiedysktos