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:

      "data":"...a bunch of HTML here...",

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

1 Answer 1


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.