Export JSON sitemap of views I have a Drupal 8 site that is using a bunch of custom views with REST endpoints. These views contain a bunch of content nodes on them which make up a single page.

I have been able to generate an XML sitemap of the views by using Simple XML Sitemap module but I am wanting to know if (and how) it's possible to generate a JSON sitemap of all the views and the paths that are associated with REST but dynamically?
Create a simple custom REST resource in a custom module and within the resource you can return a list of views and other relevant information

Here is a get() function that returns views that are enabled and their displays

/**
 * Responds to entity GET requests.
 * @return \Drupal\rest\ResourceResponse
 */
public function get() {

    $entity_ids = \Drupal::service('entity.query')
        -&gt;get('view')
        -&gt;condition('status', TRUE)
        -&gt;execute();

    $views = [];        
    foreach (\Drupal::entityManager()
        -&gt;getStorage('view')
        -&gt;loadMultiple($entity_ids) as $view) {

        $displays = [];
        // Check each display to see if it meets the criteria and is enabled.
        foreach ($view-&gt;get('display') as $id =&gt; $display) {

            // If the key doesn't exist, enabled is assumed.
            $enabled = !empty($display['display_options']['enabled']) || !array_key_exists('enabled', $display['display_options']);
            if ($enabled ) {
                $displays[] = [
                    'id' =&gt; $display['id'],
                ];
            }
        }
        $views[] = [
            'view_id' =&gt; $view-&gt;id(),
            'displays' =&gt; $displays,
        ];
    }

    $response = new ResourceResponse($views);
    return $response;
}


You can modify the views array using the for loops to display any information that you find relevant to your task.

Here is a working demo module that I did for the sake of this exercise