Input data using admin forms, then output the saved data in JSON format.
This is a simplified module to promote the importance of hook_menu, hook_form, system_settings_form, variable_set, and variable_get, and the ease of outputting Drupal data in JSON format. Security checks and other details are intentionally omitted to focus on the core concepts and the bigger picture of custom module development.
You could conveniently download the zipped file from GitHub. Just rename the unzipped module folder to json_generator (note that underscores should be used instead of dashes) before using it to you Drupal site.
After installing the module and assuming your site is http://www.example.com:
- Input some text in this URL: http://www.example.com/admin/config/json_generator
- Then, see the generated JSON data here: http://www.example.com/json_generator
Since the generated data is in JSON format (which is a universal data), it could then be used by Drupal and non-Drupal sites using JavaScript/jQuery.