# `JSONAPI.Serializer`
[🔗](https://github.com/beam-community/jsonapi/blob/main/lib/jsonapi/serializer.ex#L1)

Serialize a map of data into a properly formatted JSON API response object

# `document`

```elixir
@type document() :: map()
```

# `build_relationships`

```elixir
@spec build_relationships(Plug.Conn.t(), tuple(), tuple(), tuple(), list()) :: tuple()
```

# `build_relationships`

```elixir
@spec build_relationships(
  Plug.Conn.t(),
  tuple(),
  term(),
  term(),
  module(),
  tuple(),
  list()
) :: tuple()
```

# `data_loaded?`

```elixir
@spec data_loaded?(map() | list()) :: boolean()
```

# `encode_data`

# `encode_rel_data`

```elixir
@spec encode_rel_data(module(), map() | list()) :: map() | nil
```

# `encode_relation`

```elixir
@spec encode_relation(tuple()) :: map()
```

# `encode_relationships`

```elixir
@spec encode_relationships(Plug.Conn.t(), document(), tuple(), list()) :: tuple()
```

# `extrapolate_relationship_config`

```elixir
@spec extrapolate_relationship_config(tuple()) ::
  {atom(), atom(), module(), boolean()}
```

Given the relationship config entry provided by a JSONAPI.View, produce
the extrapolated config tuple containing:
  - The name of the relationship to be used when serializing
  - The key in the data the relationship is found under
  - The relationship resource's JSONAPI.View module
  - A boolean for whether the relationship is included by default or not

# `flatten_included`

```elixir
@spec flatten_included(
  keyword(),
  (keyword() -&gt; keyword())
) :: keyword()
```

# `serialize`

```elixir
@spec serialize(
  JSONAPI.View.t(),
  JSONAPI.View.data(),
  Plug.Conn.t() | nil,
  JSONAPI.View.meta() | nil,
  JSONAPI.View.options()
) :: document()
```

Takes a view, data and a optional plug connection and returns a fully JSONAPI Serialized document.
This assumes you are using the JSONAPI.View and have data in maps or structs.

Please refer to `JSONAPI.View` for more information. If you are in interested in relationships
and includes you may also want to reference the `JSONAPI.QueryParser`.

---

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