***

title: renderDocument
slug: /reference/typescript/agents/swml-builder/render-document
description: Serialize the SWML document to a JSON string.
max-toc-depth: 3
---------------------

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

Serializes the SWML document to a JSON string using `JSON.stringify`.

## **Parameters**

This method takes no parameters.

## **Returns**

`string` -- The JSON-encoded SWML document.

## **Example**

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

const builder = new SwmlBuilder();
builder.addVerb('answer', {});
builder.addVerb('hangup', {});

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