> 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. # toJson > Serialize all sections to a JSON string. [ref-todict]: /docs/server-sdks/reference/typescript/agents/pom-builder/to-dict [ref-fromsections]: /docs/server-sdks/reference/typescript/agents/pom-builder/from-sections Serialize all top-level sections to a JSON string. Internally calls [`toDict()`][ref-todict] and wraps the result in `JSON.stringify()`. Use this to persist a prompt for later restoration via [`PomBuilder.fromSections()`][ref-fromsections]. ## **Returns** `string` -- JSON-serialized array of section data. ## **Example** ```typescript {7} import { PomBuilder } from '@signalwire/sdk'; const pom = new PomBuilder(); pom.addSection('Intro', { body: 'Welcome.' }); pom.addSection('Rules', { bullets: ['Be nice.', 'Stay on topic.'] }); const json = pom.toJson(); // Persist, send over the wire, etc. const restored = PomBuilder.fromSections(JSON.parse(json)); ``` > Serialize all sections to a JSON string.