<<css mode="next" class="sidebar"></css>> (((
- '''<a href="/docs/fORMJSON">Class Documentation</a>''' - <a href="/api/fORMJSON">API Reference</a> - <a href="https://github.com/flourishlib/flourish-classes/blob/master/fORMJSON.php" target="_blank">Source Code</a>
<<toc></toc>>
- fActiveRecord - fRecordSet
- fORM - fORMColumn - fORMDatabase - fORMDate - fORMFile - '''fORMJSON''' - fORMMoney - fORMOrdering - fORMRelated - fORMSchema - fORMValidation
)))
The fORMJSON class is an ORM plugin to provide JSON encoding functionality to fActiveRecord and fRecordSet objects.
To add the JSON encoding functionality for whole records and record sets, simply call the static method ::extend().
The fORMJSON class adds a `toJSON()` method to both fActiveRecord and fRecordSet. Calling `toJSON()` on a record will create a single JSON object with each column being the property name and the value being the value. Calling `toJSON()` on a record set will create an array of the record JSON objects.
When outputting JSON to a browser, it is best practice to include the appropriate `Content-Type` header by calling fJSON::sendHeader().