WordPress\AiClient\Common
AbstractDataTransferObject::jsonSerialize
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.
Method of the class: AbstractDataTransferObject{}
No Hooks.
Returns
Mixed. The JSON-serializable representation.
Usage
$AbstractDataTransferObject = new AbstractDataTransferObject(); $AbstractDataTransferObject->jsonSerialize();
Changelog
| Since 0.1.0 | Introduced. |
AbstractDataTransferObject::jsonSerialize() AbstractDataTransferObject::jsonSerialize code WP 7.0.2
public function jsonSerialize()
{
$data = $this->toArray();
$schema = static::getJsonSchema();
return $this->convertEmptyArraysToObjects($data, $schema);
}