# `AgentBlueprintProtocol.Json`
[🔗](https://github.com/baselabs/agent_blueprint_protocol/blob/v1.1.0/lib/agent_blueprint_protocol/json.ex#L1)

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

```elixir
{:ok, value} = AgentBlueprintProtocol.Json.decode(~s({"ready":true}))
```

# `value`
*since 1.0.0* 

```elixir
@type value() ::
  :null
  | {:boolean, boolean()}
  | {:integer, integer()}
  | {:float, float()}
  | {:string, binary()}
  | {:array, [value()]}
  | {:object, [{binary(), value()}]}
```

A JSON value represented as a tagged scalar, array, or ordered object.

# `decode`
*since 1.0.0* 

```elixir
@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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
