---
title: WORKFLOW_DESERIALIZE
docs_index: /llms.txt
lastUpdated: 2026-10-13
---

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

A symbol used to define custom deserialization for user-defined class instances. The static method should accept serialized data and return a new class instance.

## Usage

```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);
  }
}
```

## API signature

```typescript
static [WORKFLOW_DESERIALIZE](data: SerializableData): T
```

### Parameters

### Returns

The method should return a new instance of the class, reconstructed from the serialized data.

## Requirements

> The method must be implemented as a **static** method on the class. Instance methods are not supported.

- Both `WORKFLOW_SERIALIZE` and `WORKFLOW_DESERIALIZE` must be implemented together
- The method receives the exact data that was returned by `WORKFLOW_SERIALIZE`
- If `WORKFLOW_SERIALIZE` returns complex types (like `Map` or `Date`), they will be properly deserialized before being passed to this method

> This method runs inside the workflow context and is subject to the same constraints as `"use workflow"` functions:
>
> - No Node.js-specific APIs (like `fs`, `path`, `crypto`, etc.)
> - No non-deterministic operations (like `Math.random()` or `Date.now()`)
> - No external network calls
>
> Keep this method focused on reconstructing the instance from the provided data.

---

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)