# General Translation Python SDKs: decode_options
URL: https://generaltranslation.com/en-US/docs/python/reference/functions/decode-options.mdx
Docs index: https://generaltranslation.com/llms.txt
Description: Extract the options dict from an encoded msg result in General Translation Python. API reference for decode_options.

Extracts the options dictionary from a string produced by [`msg`](/docs/python/reference/functions/msg). It decodes the base64 payload after the last colon.

## Overview [#overview]

Call `decode_options` with an encoded [`msg`](/docs/python/reference/functions/msg) result. It returns the decoded options dict, or `None` when the input has no colon or its payload is not valid.

```python
from gt_i18n import decode_options

decode_options(encoded_message)
```

Signature:

```python
decode_options(encoded_msg: str) -> dict[str, object] | None
```

Import `decode_options` from `gt_i18n`. It is not re-exported by the framework packages.

## How it works [#how-it-works]

- **Split at last colon.** It takes the text after the final colon and base64-decodes it, then parses the JSON payload.
- **Invalid or plain input.** It returns `None` when there is no colon or the payload cannot be base64-decoded or JSON-parsed.
- **Payload contents.** A decoded payload includes the user variables plus reserved keys such as `__source` and `__hash`.

## Parameters [#parameters]

| Parameter | Description | Type | Optional | Default |
| --- | --- | --- | --- | --- |
| [`encoded_msg`](#encoded-msg) | An encoded [`msg`](/docs/python/reference/functions/msg) result. | `str` | No | — |

### `encoded_msg` [#encoded-msg]

**Type** `str` · **Required**

The encoded [`msg`](/docs/python/reference/functions/msg) result to read options from.

## Returns [#returns]

**Type** `dict[str, object] | None`

The decoded options dict, or `None` when the input carries no valid options payload.

## Example [#example]

```python
from gt_i18n import msg, decode_options

encoded = msg("Save", _context="button")
decode_options(encoded)   # {"_context": "button", "__source": "Save", "__hash": "..."}
decode_options("Plain")   # None
```

## Sitemap

See the full [sitemap](https://generaltranslation.com/sitemap.md) for all pages.
