Class JsonSerializer

java.lang.Object
com.exonum.binding.common.serialization.json.JsonSerializer

public final class JsonSerializer
extends Object
Provides Gson serializer for converting Java objects to Json and vice versa. It is configured to serialize Exonum objects in a format, compatible with the core framework and light clients (e.g., HashCode as a hex string). If needed, a new serializer with adapters for service-specific types can be created, with Exonum types support already included.
  • Method Details

    • builder

      public static com.google.gson.GsonBuilder builder()
      Returns preconfigured Gson builder instance. Can be useful in cases when some customization is required. For example, type adapters should be extended or replaced.
    • json

      public static com.google.gson.Gson json()
      Returns preconfigured Gson instance. Helpful in cases when no additional configuration of the Json serializer is required.