# sm.json.writeJsonString

Writes a json string from a lua table.

**Kind:** Function

**Environments:** Game, Terrain

## Game

``` { .lua .api-signature }
sm.json.writeJsonString( root, stylized? )
```

[Open the full Game reference](../Game-Script-Environment/Static-Functions/sm.json.md#writejsonstring)

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `root` | table | The lua table. |
| `stylized` *(optional)* | boolean | Generates stylized json if true, compact if false. (Defaults to false) |

**Returns:**

| Type | Description |
| --- | --- |
| string | The json string. |

## Terrain

``` { .lua .api-signature }
sm.json.writeJsonString( root, stylized? )
```

[Open the full Terrain reference](../Terrain-Script-Environment/Static-Functions/sm.json.md#writejsonstring)

**Parameters:**

| Name | Type | Description |
| --- | --- | --- |
| `root` | table | The lua table. |
| `stylized` *(optional)* | boolean | Generates stylized json if true, compact if false. (Defaults to false) |

**Returns:**

| Type | Description |
| --- | --- |
| string | The json string. |
