WordPress\AiClient\Common

AbstractDataTransferObject::jsonSerialize │ public │ WP 0.1.0 │ ReturnTypeWillChange

Converts the object to a JSON-serializable format.

This method uses the toArray() method and then processes the result based on the JSON schema to ensure proper object representation for empty arrays.

Метод класса: AbstractDataTransferObject{}

Хуков нет.

Возвращает

mixed. The JSON-serializable representation.

Использование

$AbstractDataTransferObject = new AbstractDataTransferObject();
$AbstractDataTransferObject->jsonSerialize();

Список изменений

С версии 0.1.0 Введена.

Код AbstractDataTransferObject::jsonSerialize() WP 7.1.2

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