> This page is for Server SDKs.

> Fetch clean Markdown by appending `.md` to any page URL under https://signalwire.com/docs or requesting it with the HTTP header `Accept: text/markdown`. The root index at https://signalwire.com/docs/llms.txt lists the available documentation indexes.

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