# `Spectral.Codec.MapSet`
[🔗](https://github.com/andreashasse/spectral/blob/main/lib/spectral/codec/map_set.ex#L1)

Built-in codec for `MapSet.t()` and `MapSet.t(elem)`.

Encodes `MapSet` structs to JSON arrays and decodes JSON arrays back to `MapSet`.
The resulting JSON array reflects the unordered nature of sets — duplicate
entries that may appear in the decoded list are collapsed.

For `MapSet.t(elem)`, each element is recursively encoded/decoded according to
its type. For `MapSet.t()`, elements are passed through as-is.

## Registration

Registered automatically when the `:spectral` application starts. To use a
different codec for `MapSet.t()`, set it in `config :spectra, :codecs`;
user-configured codecs take precedence over the built-ins.

---

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