-
Notifications
You must be signed in to change notification settings - Fork 0
The JSON view
The Json view class FOF30\View\DataView\Json
is designed to create data-aware Views which result in downloadable JSON files.
JSON files can be used in Javascript as well as most major programming languages. Moreover, since the Json view supports the Hypertext Application Language (HAL) it can be used to create a RESTful application interface which can be easily used from a Javascript front-end.
This View class is simply an extension to the Raw view class. Everything described in the Raw view class still applies here. The Csv class adds a few features on top of what Raw can already do.
Setting the $this->useHypermedia
boolean property tells FOF whether it should generate application/json+hal
documents with HAL support. The default is false, creating a plain JSON file with either a list of records (browse views) or an individual record (read views). You can set this in the constructor of your view class.
When HAL support is enabled, the MIME type reported is application/json+hal
. The resulting document will contain the _links
section with links to the pagination results for browse views. By default FOF does not include embedded documents (relations).
FOF supports JSONP out of the box for all Json views. You can pass the callback
URL parameter with the name of the Javascript function you want to call. The only parameter passed to the callback function will be the generated JSON document.
FOF (Framework on Framework) and its documentation are Copyright © 2010-2020 Nicholas K. Dionysopoulos / Akeeba Ltd.
FOF is Open Source Software, distributed under the GNU General Public License, version 2 of the license, or (at your option) any later version.
The FOF Wiki content is provided under the GNU Free Documentation License, version 1.3 of the license, or (at your option) any later version.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.3 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license can be found on the GNU site.