***

title: renderSwml
slug: /reference/typescript/agents/swml-service/render-swml
description: Render the current SWML document as a JSON object.
max-toc-depth: 3
---------------------

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

Render the current SWML document as a plain object. Delegates to the
underlying SwmlBuilder's `getDocument()` method.

## **Parameters**

None.

## **Returns**

`Record<string, unknown>` -- The SWML document with `version` and `sections`.

## **Example**

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

const service = new SWMLService({ name: 'my-ivr' });
service.addVerb('answer', {});
service.addVerb('play', { url: 'https://example.com/greeting.mp3' });
service.addVerb('hangup', {});

const doc = service.renderSwml();
console.log(JSON.stringify(doc, null, 2));
// {
//   "version": "1.0.0",
//   "sections": {
//     "main": [
//       { "answer": {} },
//       { "play": { "url": "https://example.com/greeting.mp3" } },
//       { "hangup": {} }
//     ]
//   }
// }
```