# `AsyncApiSpex.Encoder`
[🔗](https://github.com/jamescarr/ankusa/blob/async_api_spex-v0.2.0/packages/async_api_spex/lib/async_api_spex/encoder.ex#L1)

Converts an `AsyncApiSpex.Document` into a JSON-encodable map.

The document is resolved first. Struct field names become lowerCamel JSON
keys, `nil`, empty maps, and empty lists are omitted, `extensions` are merged
into their owning object, and an operation's `action` is written as a string.
Plain maps and lists — AsyncAPI Schema Objects and bindings — are emitted
with their keys unchanged apart from atoms becoming strings.

# `encode!`

```elixir
@spec encode!(AsyncApiSpex.Document.t()) :: binary()
```

Encodes a document as a JSON string.

# `to_map`

```elixir
@spec to_map(AsyncApiSpex.Document.t()) :: map()
```

Encodes a document as a map. Calls `AsyncApiSpex.resolve/1` first.

---

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