Class StateJson

java.lang.Object
dev.langchain4j.internal.StateJson

public final class StateJson extends Object
Entry point for the JSON codec used where values are not known ahead of time and their types have to be written into the document.

Kept apart from ProviderJson, which describes a wire format agreed with a remote service and never writes type information.

See Also:
  • Method Details

    • codec

      public static Json.JsonCodec codec(TypeAllowlist allowlist)
      A codec is built per call rather than cached, because a TypeAllowlist is mutable and a caller registering a type expects that to apply to the codec it holds.
    • codec

      public static Json.JsonCodec codec(TypeAllowlist allowlist, ClassLoader classLoader)
      Parameters:
      classLoader - resolves the type names found in the document, or null to leave that to the JSON library. A codec cannot be told this after it is built - one of the two Jackson versions has no way to reconfigure a mapper - so changing it means asking for another codec.