private static ObjectMapper createObjectMapper() {
// it's a shame that the serialization and deserialization mechanism
// used aren't symmetric... but it works.
final DeserializerProvider deserializerProvider = new StdDeserializerProvider(new JsonRepresentationDeserializerFactory());
final ObjectMapper objectMapper = new ObjectMapper(null, null, deserializerProvider);
final SimpleModule jsonModule = new SimpleModule("json", new Version(1, 0, 0, null));
jsonModule.addSerializer(JsonRepresentation.class, new JsonRepresentationSerializer());
objectMapper.registerModule(jsonModule);
objectMapper.configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
objectMapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
return objectMapper;