# Shared Response Example

> See how to use shared response structures (g.res.shared) to reuse common response formats across APIs in API Maker.

Source: https://docs.apimaker.dev/v1/examples/res/shared/shared.html

### Share data

`g.res.shared` is used to share data between post-hooks, pre-hooks, and code within that API.

```ts
g.res.shared = {'name': 'Joe'};
return g.res.shared.name;
```

Response
```json
{
    "success": true,
    "statusCode": 200,
    "data": "Joe"
}
```

## Related

- [The global object g](https://docs.apimaker.dev/v1/docs/pre-defined-terms/global-object-g.html) · [Custom APIs](https://docs.apimaker.dev/v1/docs/apis-all/custom-apis/user-created-custom-api.html)
