# $price->toJson()

> Converts the object to a json string

- Source: `src/Toolkit/Obj.php#L110` <https://github.com/getkirby/kirby/blob/6.0.0-beta.1/src/Toolkit/Obj.php#L110>
- Inherited from Kirby, not part of the Merx API. See <https://getkirby.com/docs/reference>.

```php
$price->toJson(int $flags, int $depth = 512): string
```

## Parameters

| Name | Type | Default |
| --- | --- | --- |
| `$flags` | `int` | `0` |
| `$depth` | `int` | `512` |

## Return type

`string`

## Exceptions

| Type | Description |
| --- | --- |
| `\JsonException` | for invalid JSON |

## Parent class

`Wagnerwagner\Merx\Price` inherited from `Kirby\Toolkit\Obj`
