How do I access a view's results with a custom module? I'm creating a module that will expose a feed of content (under certain rules) as a JSON response. I want to use a Drupal 8 view to construct a query for that set of content, since it is a complicated set of rules.

Is there a way to query a Drupal 8 view in a custom module and iterate over the results?

Note that I am not trying to modify the output of the View with PHP; I just read the results and package them into a JSON response in my custom module.

I'm looking for something similar to entityQuery where I can instantiate a view object, execute it, and then iterate over the nodes that are in the result set.

Most of the searching I've done here and on Google points to Drupal 7 answers (which might not be relevant to Drupal 8 code), or otherwise generic Drupal query examples (when I am specifically looking for the Views module).

As an example, I'm looking to be able to do something like this (pseudocode):

class MyCustomModuleController {

  public function getFeed() {
    $view = View::get('my_view_name');
    $nodes = $view-&gt;execute();
    $response = [];
    foreach ($nodes as $node) {
      $response[] = $node-&gt;getSomeField();
    }
    return $response;
  }

}
$view = \Drupal\views\Views::getView('my_view_name');
$view-&gt;execute();

foreach ($view-&gt;result as $row) {
    //dont remeber if $node is fully loaded
    $node = $row-&gt;_entity;
    // if not, add this
    $node = Node:load($row-&gt;_entity-&gt;id());
    $response[] = $node-&gt;[FIELD]-&gt;view('full'); // full display
}
return $response;