@register.filter('json')
def json_filter(value):
 return mark_safe(json.dumps(value, cls=SafeJSONEncoder))

@ register . filter ( 'json' ) def json_filter ( value ) : return mark_safe ( json . dumps ( value , cls = SafeJSONEncoder ) )
returns the json representation of value in a safe manner .