Fixes #3869 Construct json data using view system rather than global variable

To Do:
 * Handle exceptions - http://trac.elgg.org/ticket/5062#ticket
 * Provide json for user and group profile pages - http://trac.elgg.org/ticket/5061#ticket
 * Separate the json views from the export system
 * Provide a way for plugins to extend/change what is available in the json data (maybe $object->getPublicCopy() which triggers a plugin hook)