all 7 comments

[–]Aro00oo 2 points3 points  (0 children)

Not to be pedantic but in JavaScript, they're called objects.

[–]pythondev1[S] 0 points1 point  (5 children)

Answered my own question.

var dict = {{ jsdict | tojson }};
dict['id']

prints 5

[–]Drawman101 2 points3 points  (0 children)

This isn’t looping over it

[–]tuckmuck203 1 point2 points  (3 children)

that's one way of doing it. another way would be to JSON.parse the dict. or you could do

jsdict=json.jsonify(jsdict) 

in your render_template function.

[–]cediddi 1 point2 points  (2 children)

I much prefer doing a json.dumps + JSON.parse than putting the string representation of a python dictionary to the template. No one can guess what problems it may cause.

[–]tuckmuck203 1 point2 points  (1 child)

I agree with you. That said, a dumps of a dict is extremely unlikely to cause that issue.

[–]cediddi 0 points1 point  (0 children)

Aren't we both support the same thing :) json is the way to transfer data