How to access object properties in Grav?

Here’s the output of dump(Grav::instance()['uri']):

I’ve tried to get #paths[2] this way Grav::instance()['uri']->paths[2], but i’m getting this error: Cannot access protected property Grav\Common\Uri::$paths

It’s protected by the class definition. You’re not allowed to access it directly. What exactly are you trying to get out of the object? If you look at the URI API, you’ll see there’s a path() method that may get you what you’re looking for.