Added decorator to produce structured response

@czue 
http://manage.dimagi.com/default.asp?131002
I'm not sure that we should catch all exceptions.