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?


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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