Class JacksonJsonConverter

java.lang.Object
tech.ydb.yoj.repository.db.json.JacksonJsonConverter
All Implemented Interfaces:
JsonConverter

public final class JacksonJsonConverter extends Object implements JsonConverter
YOJ JSON Converter implementation using Jackson as the underlying JSON library. Use it to support JSON-valued fields (@Column(flatten=false) composite objects and dynamic fields with type of interface/abstract class, e.g. List):
 CommonConverters.defineJsonConverter(JacksonJsonConverter.getDefault());
 

Note that the CommonConverters.defineJsonConverter() configuration API is unstable and subject to change (and potential deprecation for removal.)

You can obtain an instance of JacksonJsonConverter in a number of ways:

  • To get JacksonJsonConverter which uses reasonable defaults, call getDefault().
  • To customize these reasonable defaults, use the JacksonJsonConverter(UnaryOperator) constructor:
     CommonConverters.defineJsonConverter(new JacksonJsonConverter(mapper -> mapper
         .set[...]()
         .registerModule(...)
         .configure(...)
     ));
     
  • To supply an externally created ObjectMapper, use the #JacksonJsonConverter(ObjectMapper) constructor.