I am trying to use \Drupal\node\Entity\Node::load($nid) to store a node object in a variable and pass the variable into drupal 8's serialization component or even symphony's serialization methods. All my efforts have resulted in a JSON object that is only encoding the first property of the node which is {"in_preview":null}.
For example the following callback returns {"in_preview":null}
public function page(){
$nrm = new \Drupal\Component\Serialization\Json;
$node = Node::load(2);
$json = $nrm -> encode($node, 'json');
return $json;
}
What class/method would accomplish serialization of $node in the above code?