public String value1;
public String value2;
}
private ObjectMapper createObjectMapper() {
SimpleModule module = new SimpleModule("MySimpleModule", new Version(1,
0, 0, null, "", ""));
module.addDeserializer(Custom.class, new JsonDeserializer<Custom>() {
@Override
public Custom deserialize(JsonParser jp, DeserializationContext ctxt)
throws IOException {
JsonNode node = jp.readValueAsTree();
return new Custom(node.get("v1").asText(), node.get("v2")
.asText());
}
});
module.addSerializer(Custom.class, new JsonSerializer<Custom>() {
@Override
public void serialize(Custom value, JsonGenerator jgen,
SerializerProvider provider) throws IOException {
jgen.writeStartObject();
jgen.writeFieldName("v1");