0

I want to fetch latest Drupal 7 posts in json format with the file extension of '.json'

I have tried multiple methods to GET data in JSON format using PHP but doing so keeps the file name as .php, I am unable to create the '.json' file.

How to create dynamic JSON file like this?: http://json-schema.org/example/calendar.json

Can someone please share some inputs or help with some useful resource which I can refer to in order to achieve this.

DUPLICATE - This may be a duplicate question but there is no answer available for this. The link provided by 'Quentin' does not have an accepted answer and also it does not have the answer to my question.

itsMe
  • 617
  • 2
  • 9
  • 23
  • You don't need it to have a `.json` extension to work. A `.php` extension (or no extension!) can output JSON just fine, you'll just want to send the proper `Content-Type: application/json` header. – ceejayoz Dec 18 '17 at 14:00
  • Agreed, but I would like to know how to generate a '.json' extension. Could you please help with that? – itsMe Dec 19 '17 at 08:21
  • Is this question about creating the JSON output, or the file ending? – Philipp Dec 19 '17 at 08:23
  • If you want the later, the duplicate answer contains the solution - even if not accepted – Philipp Dec 19 '17 at 08:27

0 Answers0