Changed some functions in json utils and added a decorator for json views.