main/core/Twig/SerializerExtension.php
public function apiSerialize($object, $options = [])
    {
        if (!empty($object)) {
            return $this->serializerProvider->serialize($object, $options);
        }

        return $object;
    }
public function apiSerialize($object, $options = [])
    {
        if (!empty($object)) {
            return $this->serializerProvider->serialize($object, $options);
        }

        return $object;
    }
public function apiSerialize ( $ object , $ options = [ ] ) { if ( ! empty ( $ object ) ) { return $ this -> serializerProvider -> serialize ( $ object , $ options ) ; } return $ object ; }
Serializes data to JSON using the SerializerProvider.

@param mixed $object
@param array $options

@return mixed
Serializes data to JSON using the SerializerProvider .