Behaviour for JSON encoding/decoding.
By default, uses Elixir's built-in JSON module (available since Elixir 1.18)
when present, falling back to Jason. If neither is available, raises at runtime.
To override the auto-detected default:
config :grephql, :json_library, JasonA custom implementation must export encode!/1 and decode/1
(see @callback definitions below).
Summary
Functions
Decodes a JSON string. Returns {:ok, term} or {:error, reason}.
Encodes a term to a JSON string. Raises on failure.
Returns the configured JSON library module.
Callbacks
Functions
Decodes a JSON string. Returns {:ok, term} or {:error, reason}.
Encodes a term to a JSON string. Raises on failure.
@spec library() :: module()
Returns the configured JSON library module.