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

# renderDocument

> Render the current SWML document as a JSON string.

[ref-getdocument]: /docs/server-sdks/reference/typescript/agents/swml-service/get-document

[ref-renderswml]: /docs/server-sdks/reference/typescript/agents/swml-service/render-swml

Render the current SWML document as a JSON string. This is the serialized form
returned to SignalWire when a call requests SWML. Delegates to
`SwmlBuilder.renderDocument()` under the hood.

<Note>
  For the document as a plain object, use [`getDocument()`][ref-getdocument] or
  [`renderSwml()`][ref-renderswml] instead.
</Note>

## **Returns**

`string` — The SWML document serialized as a JSON string.

## **Example**

```typescript {7}
import { SWMLService } from '@signalwire/sdk';

const service = new SWMLService({ name: 'my-service' });
service.addVerb('answer', {});
service.addVerb('hangup', {});

const jsonStr = service.renderDocument();
console.log(jsonStr);
// '{"version":"1.0.0","sections":{"main":[{"answer":{}},{"hangup":{}}]}}'
```