Files
web2py/applications/examples/views/generic.json
Massimo Di Pierro e9fadbc40b added tagcloud
2011-11-23 01:14:19 -06:00

16 lines
427 B
JSON

{{
###
# response._vars contains the dictionary returned by the controller action
###
try:
from gluon.serializers import json
response.write(json(response._vars), escape=False)
response.headers['Content-Type'] = 'application/json; charset=utf-8'
except (TypeError, ValueError):
raise HTTP(405, 'JSON serialization error')
except ImportError:
raise HTTP(405, 'JSON not available')
except:
raise HTTP(405, 'JSON error')
}}