Implement hook_file_entity_access for JSON results.

From #2871.