0

I trying to create a json object and pass that object to template.render(JSONObj), but there is some error saying

ValueError: dictionary update sequence element #0 has length 1; 2 is required

What am I doing wrong?

1
  • I am also facing the same prob. Please somebody help us.. Commented May 28, 2012 at 15:37

1 Answer 1

7

You have to give that "JSONObj" object a key value. The template recieves a dictionary with objects and values to render inside it. So, try using this:

template.render(jsonobj=JSONObj)

Then, in your template, you can use this object this way:

{{jsonobj.some_key_inside_json_object}}

This jsonobj is a name that identifies your "JSONObj" object inside the template's arguments.

Hope it helps!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.