private function objectTransform($val)
    {
        if (! is_object($val)) {
            return $val;
        } elseif ($val instanceof Accessable) {
            return $this->serialize($val);
        } else {
            // Fallback for stdClass objects
            return json_decode(json_encode($val), true);
        }
    }