# gt-node: General Translation Node.js SDK: decodeOptions URL: https://generaltranslation.com/en-GB/docs/node/reference/functions/decode-options.mdx --- title: decodeOptions description: Recover the encoded options from a General Translation encoded message. API reference for decodeOptions. --- Decodes the options object that [`msg`](/docs/node/reference/functions/msg) embedded in an encoded message. Use it to inspect the metadata and interpolation variables carried by an encoded message. ## Overview [#overview] Call `decodeOptions` with an encoded message. It parses and returns the options object, or `null` if the message has no encoded options or cannot be parsed. ```ts import { msg, decodeOptions } from 'gt-node'; const encoded = msg('Hello, {name}!', { name: 'Brian' }); console.log(decodeOptions(encoded)); // { name: 'Brian', $_source: 'Hello, {name}!', $_hash: '...' } ``` Signature: ```ts decodeOptions(encodedMsg: string): TranslationOptions | null ``` ## How it works [#how-it-works] * **Separator split.** An encoded message has the form `interpolatedContent:encodedOptions`. `decodeOptions` reads the segment after the last colon, base64-decodes it, and parses the JSON options. * **Null result.** When the message has no colon separator, or the encoded segment cannot be parsed, it returns `null`. ## Parameters [#parameters] | Parameter | Description | Type | Optional | Default | | ---------------------------- | ----------------------------------------- | -------- | -------- | ------- | | [`encodedMsg`](#encoded-msg) | The encoded message to read options from. | `string` | No | — | ### `encodedMsg` [#encoded-msg] **Type** `string` · **Required** The message to decode, typically a value returned by [`msg`](/docs/node/reference/functions/msg). ## Returns [#returns] **Type** `TranslationOptions | null` The decoded options object, including any interpolation variables and metadata such as `$_source` and `$_hash`, or `null` when there are no options to decode. ## Examples [#examples] ```ts import { msg, decodeOptions } from 'gt-node'; const encoded = msg('You have {count} messages', { count: 3 }); const options = decodeOptions(encoded); console.log(options?.count); // 3 console.log(decodeOptions('Plain text')); // null ``` ## Notes [#notes] * To read the message content instead of its options, use [`decodeMsg`](/docs/node/reference/functions/decode-msg).