---
jsApi: true
title: "[F] $encode"

---
```ts
$encode(
  context,
  target,
  encoding,
  encodeAs?): void
```

## Parameters

| Parameter | Type |
| :------ | :------ |
| `context` | [`DecoratorContext`](Interface.DecoratorContext.md) |
| `target` | [`ModelProperty`](Interface.ModelProperty.md) \| [`Scalar`](Interface.Scalar.md) |
| `encoding` | `string` \| [`EnumMember`](Interface.EnumMember.md) |
| `encodeAs`? | [`Scalar`](Interface.Scalar.md) |

## Returns

`void`
