WordPress at a glance
function is not described

rest_sanitize_object() WP 5.5.0

Converts an object-like value to an object.

No Hooks.

Return

Array. Returns the object extracted from the value.

Usage

rest_sanitize_object( $maybe_object );
$maybe_object(mixed) (required)
The value being evaluated.

Changelog

Since 5.5.0 Introduced.

Code of rest_sanitize_object() WP 5.7.2

<?php
function rest_sanitize_object( $maybe_object ) {
	if ( '' === $maybe_object ) {
		return array();
	}

	if ( $maybe_object instanceof stdClass ) {
		return (array) $maybe_object;
	}

	if ( $maybe_object instanceof JsonSerializable ) {
		$maybe_object = $maybe_object->jsonSerialize();
	}

	if ( ! is_array( $maybe_object ) ) {
		return array();
	}

	return $maybe_object;
}