1

In Drupal 7 how can I get Views data encoded as JSON? There's the built-in http://yourdrupal/views/ajax URL that will return the View data as HTML. For instance it will return:

   {
      "command":"insert",
      "method":"replaceWith",
      "selector":".view-dom-id-1",
      "data":"...a bunch of HTML here...",
      "settings":null
   }

The data is correct but it's formatted as HTML - how can it be formatted as JSON instead?

9

Check out views_datasource. It allows to specify a views display of type 'JSON'.

Not the answer you're looking for? Browse other questions tagged or ask your own question.