This question has been answered by multiple community members. See the first response.
$res = $modx->getObject('modResource',1);
// !!!
if (! is_object($res)) {
$modx->log(modX::LOG_LEVEL_ERROR, 'Ресурс не найден!');
return false;
}
$output = $res->toArray();
print "<pre>";
print_r($output);
$res->get($val)