Class Json


  • public class Json
    extends Object
    The Json class provides helper utilities for creating the singleton object mapper. For most use cases, you can simply call getObjectMapper() without anything extra. You can instantiate the singleton object mapper with a custom configuration using createObjectMapper().
    • Method Detail

      • getDefaultConfig

        public static jakarta.json.bind.JsonbConfig getDefaultConfig()
        Returns the default JsonbConfig configuration. In addition to the standard Jsonb defaults: 1) Uses field visibility 2) Sorts lexicographically
        Returns:
        The default JsonbConfig.
      • initObjectMapper

        public static void initObjectMapper​(jakarta.json.bind.JsonbConfig config)
        Initializes the object mapper. Can only be called once. Cannot be called after getObjectMapper(). If you need a custom configuration, you should call this method once at the beginning of your application.
        Parameters:
        config - The object mapper configuration.
      • getObjectMapper

        public static jakarta.json.bind.Jsonb getObjectMapper()
        Returns the object mapper singleton.
        Returns:
        The object mapper singleton.