JSON mutation hooks
Rewrite API response bodies and action arrays per route.
Register during init with hook_json!(host, JsonMutateTarget::Variant, route, callback).
json.responseMutate the entire JSON response object.json.actionsMutate only the top-level actions array.Action object shape
{
"id": "plugin_action",
"label": "Plugin action",
"step": "GET /plugins/example"
}
Quick reference
| Target | Summary | Route matching |
|---|---|---|
json.response | Mutate the entire JSON response object. | Prefix match on request path. Examples: `/api/system`, `/api`, `*`. |
json.actions | Mutate only the top-level actions array. | Same prefix rules as json.response. |