# Json

> Converts strings to JSON-safe debug storage representations.

[API reference](/docs/api/index.md) › [Debug Core](/docs/extensions/debug-core/reference/index.md) › [Storage](/docs/extensions/debug-core/reference/storage/index.md) › Json

| final class | `PHPForge\Debug\Storage\Json` |
| --- | --- |
| Source | [`src/Storage/Json.php`](https://github.com/php-forge/debug-core/blob/main/src/Storage/Json.php#L14) |

Converts strings to JSON-safe debug storage representations.

## Methods

| Method | Description | Defined by |
| --- | --- | --- |
| [`payload()`](#method-payload) static | Freezes a provider payload as JSON values before it enters the request envelope. | `Json` |
| [`safeString()`](#method-safeString) static | Returns valid UTF-8, representing binary text as base64. | `Json` |

## Method details

### payload() <span id="method-payload"></span>

```php
public static function payload(array<string, mixed> $payload): array<string, mixed>
```

Freezes a provider payload as JSON values before it enters the request envelope.

Strict encoding rejects invalid UTF-8, non-finite numbers, resources, cycles, and excessive depth.
Decoding freezes nested serialization results so application callbacks never run again during storage.
The depth limit reserves room for the request envelope. No redaction or truncation is applied here.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$payload` | `array<string, mixed>` |  |

**Returns**

`array<string, mixed>`

### safeString() <span id="method-safeString"></span>

```php
public static function safeString(string $value): string
```

Returns valid UTF-8, representing binary text as base64.

**Parameters**

| Parameter | Type | Description |
| --- | --- | --- |
| `$value` | `string` | String to normalize. |

**Returns**

`string`: JSON-safe string.