toDict

View as MarkdownOpen in Claude

Convert the entire model to an array of plain SectionData objects. Useful for serializing the POM for storage or passing to other components.

Parameters

None.

Returns

SectionData[] — Serialized section list. See the PromptObjectModel overview for the SectionData shape.

Example

1import { PromptObjectModel } from '@signalwire/sdk';
2
3const pom = new PromptObjectModel();
4pom.addSection('Role', { body: 'You are a helpful assistant.' });
5
6const data = pom.toDict();
7console.log(JSON.stringify(data, null, 2));