---
title: JSON
slug: aura/json
docTags: 
createdAt: 2025-07-07T20:39:55.891Z
---

A biblioteca JSON fornece funções para codificar e decodificar valores JSON em Lua, permitindo a conversão entre tabelas Lua e strings JSON.

## Atalhos

- **[Decode](docId\:OZFlYt9SMsSycpE0m4vvi)**
- **[Encode](docId\:OZFlYt9SMsSycpE0m4vvi)**

***

### Métodos

### Decode

```lua
-- @param value The value to be decoded.
-- @return string containing the decoded value
json.decode(value)
```

```lua
-- example usage:

local decoded = json.decode('{"xxx": "yyy"}')
```

### Encode

```lua
-- @param value The value to be encoded.
-- @param @optional empty_as_array Boolean that defines if an empty table should be encoded as an array, defaults to false.
-- @return string containing the encoded value
json.encode(value, empty_as_array)
```

```lua
-- example usage:

local encoded = json.encode({xxx = "yyy"})
```

