> For a complete index of all SignalWire documentation pages, fetch https://signalwire.com/docs/llms.txt

# toYaml

> Serialize the model to a YAML string.

[ref-todict]: /docs/server-sdks/reference/typescript/agents/pom-object-model/to-dict

[ref-fromyaml]: /docs/server-sdks/reference/typescript/agents/pom-object-model/from-yaml

Serialize the entire model to a YAML string. Internally calls
[`toDict()`][ref-todict] and dumps the result. Restore later via
[`fromYaml()`][ref-fromyaml].

## **Parameters**

None.

## **Returns**

`string` -- YAML-serialized array of section data.

## **Example**

```typescript {6}
import { PromptObjectModel } from '@signalwire/sdk';

const pom = new PromptObjectModel();
pom.addSection('Intro', { body: 'Welcome.' });

const yaml = pom.toYaml();
const restored = PromptObjectModel.fromYaml(yaml);
```