Converts the object to a JSON-serializable format.
Description
This method uses the toArray() method and then processes the result based on the JSON schema to ensure proper object representation for empty arrays.
Source
#[\ReturnTypeWillChange]
public function jsonSerialize()
{
$data = $this->toArray();
$schema = static::getJsonSchema();
return $this->convertEmptyArraysToObjects($data, $schema);
}
Changelog
| Version | Description |
|---|---|
| 0.1.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.