How do I access a field value for an entity (e.g. node) object? node_load((int) $nid) loads a fully-populated node entity. $node-&gt;title-&gt;value gets the title, but how do I access field values in Drupal 8?
I guess you do not need to convert $entity into an array,
this would simply work.

$entity-&gt;get('field_name')-&gt;getValue();


FYI : Using kint() from the devel_kint module will let you know all the available methods that could be used to access the object elements, so comparatively var_dump() is less helpful.