Class Json

java.lang.Object
org.minijax.json.Json

public class Json
extends java.lang.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 Summary

    Modifier and Type Method Description
    static jakarta.json.bind.JsonbConfig getDefaultConfig()
    Returns the default JsonbConfig configuration.
    static jakarta.json.bind.Jsonb getObjectMapper()
    Returns the object mapper singleton.
    static void initObjectMapper​(jakarta.json.bind.JsonbConfig config)
    Initializes the object mapper.
    static boolean isCompatible​(jakarta.ws.rs.core.MediaType mediaType)  

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • 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.
    • isCompatible

      public static boolean isCompatible​(jakarta.ws.rs.core.MediaType mediaType)