# `Codex.Turn.Result`
[🔗](https://github.com/nshkrdotcom/codex_sdk/blob/v0.16.1/lib/codex/turn/result.ex#L1)

Result struct returned from turn execution.

# `t`

```elixir
@type t() :: %Codex.Turn.Result{
  attempts: non_neg_integer(),
  events: [Codex.Events.t()],
  final_response: Codex.Items.AgentMessage.t() | map() | nil,
  last_response_id: String.t() | nil,
  raw: map(),
  thread: Codex.Thread.t(),
  usage: map() | nil
}
```

# `json`

```elixir
@spec json(t()) :: {:ok, term()} | {:error, term()}
```

Returns the decoded structured output when available.

If the turn produced structured output and it was successfully decoded, the
parsed map (or list) is returned. When the output is present but could not be
decoded, an error tuple is returned. For natural language responses, `:not_structured`
is returned.

---

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