src/Leevel/Collection/Collection.php
public function jsonSerialize(): array
    {
        return array_map(function ($value) {
            if ($value instanceof JsonSerializable) {
                return $value->jsonSerialize();
            }

            if ($value instanceof IJson) {
                return json_decode($value->toJson(), true);
            }

            if ($value instanceof IArray) {
                return $value->toArray();
            }

            return $value;
        }, $this->elements);
    }
public function jsonSerialize(): array
    {
        return array_map(function ($value) {
            if ($value instanceof JsonSerializable) {
                return $value->jsonSerialize();
            }

            if ($value instanceof IJson) {
                return json_decode($value->toJson(), true);
            }

            if ($value instanceof IArray) {
                return $value->toArray();
            }

            return $value;
        }, $this->elements);
    }
实现 JsonSerializable::jsonSerialize.

@return array