---
updatedAt: 2025-05-20T20:28:47.000Z
agentTools:
  projectIndex: https://docs.documotor.com/llms.txt
---

# to_string

Convert a piece of data to string

# Definition

`string to_string(any $arg)`

Returns the JSON encoded value of `$arg`, i.e., the way that `$arg` is represented in the JSON file.

# Parameters

<Glossary>any</Glossary> `$arg`

A piece of data of any type.

# Returns

<Glossary>string</Glossary>

The string representing `$arg` inside a JSON file.

# Examples

```text Transformation
{
  a: to_string(`null`),
  b: to_string(`1`),
  c: to_string('text'),
  d: to_string(`{name: 'Jane'}`),
  e: to_string(`[]`),
  f: to_string(`[1, 2, 3]`)
}
```

```json Result
{
  "a": "null",
  "b": "1",
  "c": "text",
  "d": "{\"name\":\"Jane\"}",    // The backslash is used to escape apostrophes
  "e": "[]",
  "f": "[1,2,3]"
}
```