# `DDD.MCP.Json`
[🔗](https://github.com/blackuprise/vicander/blob/v0.1.1/lib/ddd/mcp/json.ex#L1)

Turns the result of a command, query or repository lookup into JSON.

Domain structs (aggregates, entities, value objects) are written with `DDD.Serializer`, so
every field type has its JSON form (decimals and dates as text, enums as strings, nested
entities as objects). Everything else is converted structurally. All fields are shown: a
query that must hide something returns a map it built itself.

# `encode`

```elixir
@spec encode(term()) :: String.t()
```

The JSON text of `value`.

# `prepare`

```elixir
@spec prepare(term()) :: term()
```

A JSON-ready term (maps with string keys, lists, strings, numbers, booleans, nil).

---

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