# `Grephql.ResponseDecoder`
[🔗](https://github.com/fahchen/grephql/blob/v0.10.1/lib/grephql/response_decoder.ex#L1)

Decodes GraphQL JSON response data into typed embedded schema structs.

Uses `Ecto.embedded_load/3` to recursively convert plain maps (from
`Jason.decode!/1`) into the generated embedded schema structs, automatically
invoking custom `Ecto.Type.cast/2` callbacks for scalars and enums.

## Example

    json = %{"name" => "Alice", "posts" => [%{"title" => "Hello"}]}
    user = Grephql.ResponseDecoder.decode!(MyApp.GetUser.User, json)
    user.name #=> "Alice"
    hd(user.posts).title #=> "Hello"

# `decode!`

```elixir
@spec decode!(module(), map()) :: struct()
```

Decodes a JSON map into the given embedded schema module.

Raises on failure.

---

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