WP_HTTP_Response::jsonSerialize() WordPress Method
The WP_HTTP_Response::jsonSerialize() Wordpress method allows a user to serialize a WordPress HTTP response into JSON format. This is useful for creating an API or for debugging purposes.
WP_HTTP_Response::jsonSerialize() #
Retrieves the response data for JSON serialization.
Description
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.
Return
(mixed) Any JSON-serializable value.
Source
File: wp-includes/class-wp-http-response.php
public function jsonSerialize() { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid return $this->get_data(); }
Expand full source codeCollapse full source codeView on TracView on GitHub
Changelog
Version | Description |
---|---|
4.4.0 | Introduced. |