---
title: "@workflow/serde"
docs_index: /llms.txt
lastUpdated: 2026-10-13
---

> For an index of all documentation, see [/llms.txt](/llms.txt).

Serialization symbols for custom class serialization in Workflow SDK.

## Installation

```bash
npm i @workflow/serde
```

```bash
pnpm add @workflow/serde
```

```bash
yarn add @workflow/serde
```

```bash
bun add @workflow/serde
```

## Overview

By default, Workflow SDK can serialize standard JavaScript types like primitives, objects, arrays, `Date`, `Map`, `Set`, and more. However, custom class instances are not serializable by default because the serialization system doesn't know how to reconstruct them.

The `@workflow/serde` package provides two symbols that allow you to define custom serialization and deserialization logic for your classes, enabling them to be passed between workflow and step functions.

## Symbols

#### [WORKFLOW\_SERIALIZE](/docs/api-reference/workflow-serde/workflow-serialize)

Symbol for defining how to serialize a class instance to plain data.

#### [WORKFLOW\_DESERIALIZE](/docs/api-reference/workflow-serde/workflow-deserialize)

Symbol for defining how to reconstruct a class instance from plain data.

## Quick example

```typescript lineNumbers
import { WORKFLOW_SERIALIZE, WORKFLOW_DESERIALIZE } from "@workflow/serde";

class Point {
  constructor(public x: number, public y: number) {}

  static [WORKFLOW_SERIALIZE](instance: Point) {
    return { x: instance.x, y: instance.y };
  }

  static [WORKFLOW_DESERIALIZE](data: { x: number; y: number }) {
    return new Point(data.x, data.y);
  }
}
```

> For a complete guide on custom class serialization, see the [Serialization documentation](/docs/foundations/serialization#custom-class-serialization).

---

For a semantic overview of all documentation, see [/sitemap.md](/sitemap.md)

For an index of all available documentation, see [/llms.txt](/llms.txt)

For agent-facing discovery, including API and MCP surfaces, see [/agents.md](/agents.md)