Views JSON Query for Drupal 8

Drupal 8 is a major update, and all Drupal-7-extensions need to be updated to work with the latest version.

In the last days I had to work with the "Views JSON Query"-extension. It is for Drupal 7 only, but there is an update patch for Drupal 8 in the discussion form.

This patch works fine, if you only want to display tables. But it fails with empty values in grid or other display types.

The solution:

Open views_json_query/src/Plugin/views/query/JsonQuery.php in an editor and add

        array_walk($results, function(ResultRow $row, $index) {
          $row->index = $index;

in line 220 (right after $this->view->result = $results;).