Archive For 8. November 2015

Adding JsonRawValue deserialization support

By |

Jackson provides a functionallity with com.fasterxml.jackson.annotation.JsonRawValue annotation to serialize a raw string to the output json. The opposite way is currently not supported directly, but a simple custom Deserializer can add the required functionallity: public class JsonRawValueDeserializer extends JsonDeserializer<String> { @Override public String deserialize(JsonParser jp, DeserializationContext context) throws IOException { return jp.readValueAsTree().toString(); } } The…

Read more »