This module decodes bounded JSON into an order-preserving tagged value.
Use it when decoding protocol JSON before passing the value to another module.
This module does not authorize operations.
Example
{:ok, value} = AgentBlueprintProtocol.Json.decode(~s({"ready":true}))
Summary
Functions
Decodes bounded JSON into an order-preserving tagged value.
Types
Functions
@spec decode(binary(), AgentBlueprintProtocol.Bounds.t() | map()) :: {:ok, value()} | {:error, AgentBlueprintProtocol.Error.t()}
Decodes bounded JSON into an order-preserving tagged value.
Example
iex> match?({:ok, {:object, [{"ready", {:boolean, true}}]}}, AgentBlueprintProtocol.Json.decode(~S({"ready":true})))
true
iex> match?({:ok, {:object, [{"ready", {:boolean, true}}]}}, AgentBlueprintProtocol.Json.decode(~S({"ready":true}), %{bytes: 32}))
true