How to append Object to existing JSON file with Jackson

Viewed 11352

How do i append an object to an existing JSON file with Jackson?

File file = new File("test.json");
if (!file.exists()) {
    file.createNewFile();
}

ObjectMapper mapper = new ObjectMapper();

ObjectWriter writer = mapper.writer(new DefaultPrettyPrinter());
mapper.writeValue(file, wtf);
2 Answers
Related