The JsonSerializable interface
From Get docs
Php/docs/latest/class.jsonserializable
The JsonSerializable interface
Introduction
(PHP 5 >= 5.4.0, PHP 7, PHP 8)
Objects implementing JsonSerializable can customize their JSON representation when encoded with json_encode().
Interface synopsis
interface JsonSerializable {
public jsonSerialize(): mixed
}
Table of Contents
- JsonSerializable::jsonSerialize — Specify data which should be serialized to JSON
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.jsonserializable.php
/* Methods */