use json.dumps instead of manually constructing json in template