The problem is length is one of the words in the word cloud, i.e. a key for the dictionary. obj.length no longer returned the length of the object, but the tuple of things I made in Python! jQuery happily looped over the attributes in the object when length was not a dictionary key, but fell over when it did. The crude solution is to append each keyword with a ‘_’ and then remove it when displaying it, so length becomes _length which causes no clashes.
I wonder if there are any exciting scripting vulnerabilities you could expose with this?