Django template object jsonify

1
2
3
4
5
6
7
8
9
from django import template
from django.utils.safestring import mark_safe
from django.utils import simplejson

register = template.Library()

@register.filter
def jsonify(o):
    return mark_safe(simplejson.dumps(o))

Comments

fallhunter (on December 15, 2008):

cool thing

#

hikozaemon (on December 15, 2008):

it's cool

#

Oduvan (on December 17, 2008):

simle and useful - GREATE

#

(Forgotten your password?)

You may use Markdown syntax here, but raw HTML will be removed.