> ## Documentation Index
> Fetch the complete documentation index at: https://docs.arouter.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# レスポンスヒーリング

> ARouter は json_schema または json_object レスポンス形式を使用する際、不正な JSON レスポンスを自動的に修復します。

レスポンスヒーリングは、構造化出力をリクエストした際に、モデルレスポンスの不正な JSON を自動的に修復します。

## 有効化条件

以下の両方の条件が満たされた場合のみ：

1. `response_format` が `json_schema` または `json_object` に設定されている
2. レスポンスボディが有効な UTF-8 だが、修正可能な JSON 構文エラーが含まれている

## 修復対象

| 問題               | 修復後                |
| ---------------- | ------------------ |
| Markdown コードブロック | `{"key": "value"}` |
| 末尾のカンマ           | `{"a": 1, "b": 2}` |
| クォートなしのキー        | `{"key": "value"}` |
| テキスト + JSON の混在  | `{"id": 1}`        |
| シングルクォート文字列      | `{"key": "value"}` |

## 修復されたレスポンスの検出

```json theme={null}
{
  "choices": [{"message": {"role": "assistant", "content": "{\"name\": \"John Doe\"}"}, "finish_reason": "stop"}],
  "x_arouter": {"response_healed": true}
}
```

## 制限事項

* **非ストリーミングのみ** — ストリーミングレスポンスには適用されない
* 切り捨てられた出力は修復しない
* 構文エラーは修復するが、意味エラーは修復しない

## 関連ドキュメント

* [構造化出力](/jp/guides/features/structured-outputs)
* [プラグイン概要](/jp/guides/features/plugins-overview)
