Configurable JSON boundary used by ExWapp.
ExWapp deliberately does not depend on a JSON implementation. The host
application must provide a module exposing encode/1 and decode/1 with
the conventional {:ok, value} | {:error, reason} return shape:
config :ex_wapp, :json_library, JasonJason, Poison, Elixir's JSON module, or a small adapter around another
implementation can be used. Modules exposing only the bang variants are
supported too.
Summary
Functions
Decodes JSON with the configured JSON implementation.
Decodes JSON or raises when JSON is unavailable or decoding fails.
Encodes a value with the configured JSON implementation.
Encodes a value or raises when JSON is unavailable or encoding fails.
Returns the JSON module configured by the host application.
Types
Functions
@spec decode(iodata()) :: {:ok, term()} | {:error, error_reason()}
Decodes JSON with the configured JSON implementation.
Decodes JSON or raises when JSON is unavailable or decoding fails.
@spec encode(term()) :: {:ok, binary()} | {:error, error_reason()}
Encodes a value with the configured JSON implementation.
Encodes a value or raises when JSON is unavailable or encoding fails.
@spec library() :: {:ok, module()} | {:error, error_reason()}
Returns the JSON module configured by the host application.