AbstractDataTransferObject::jsonSerialize(): mixed

In this article

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.

Return

mixed The JSON-serializable representation.

Source

#[\ReturnTypeWillChange]
public function jsonSerialize()
{
    $data = $this->toArray();
    $schema = static::getJsonSchema();
    return $this->convertEmptyArraysToObjects($data, $schema);
}

Changelog

VersionDescription
0.1.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.