Peter Peter - 1 year ago 96
JSON Question

Drupal 7 views_datasource output only the json instead full html page

I using Drupal 7 and views_datasource.

I created a new view and set the Format as JSON data document. I also set a path to this view and let say /json-output.

When I access this /json-output it will display the full html page together with the json in the body.

My question is how to I retrieve only the json without the full html?

Thanks in advance!

Answer Source
  1. Go to the configuration of your Views display which produces the JSON output.
  2. Click on the Settings link of the JSON data document format. Make sure that Views API mode is not enabled.

The explanation

Not using View API mode means the JSON gets output directly and the server ceases normal page processing. Using it means the server does not cease processing after outputting the JSON. This allows the Views API to be used with the view without having to prematurely terminate page processing.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download