WordPress at Your Fingertips
function is not described

WP_HTTP_Response::jsonSerialize() public WP 4.4.0

Retrieves the response data for JSON serialization.

It is expected that in most implementations, this will return the same as get_data(), however this may be different if you want to do custom JSON data handling.

{} It's a method of the class: WP_HTTP_Response{}

No Hooks.


Mixed. Any JSON-serializable value.


$WP_HTTP_Response = new WP_HTTP_Response();
$WP_HTTP_Response->jsonSerialize() // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid;


Since 4.4.0 Introduced.

Code of WP_HTTP_Response::jsonSerialize() WP 5.8.2

public function jsonSerialize() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
	return $this->get_data();