I must be missing something here. I call a function that returns a dictionary that I then encode into JSON. If I use the dictionary object returned by the function and pass it into the JSON encode, I hit a recursion error. If I create a new variable with the same dictionary, it works fine. Does anyone have any ideas?
reqParameters = ""
reqRemainingPath = ""
broken = request(reqParameters, reqRemainingPath)
works = {'racks': [{'sampleCount': 0, 'createdAt': 0, 'trayCode': u'asdfasdf', 'rackType': 1}, {'sampleCount': 0, 'createdAt': 0, 'trayCode': u'qwerqwer', 'rackType': 2}, {'sampleCount': 0, 'createdAt': 0, 'trayCode': u'zxcvzxcv', 'rackType': 1}]}
print type(broken)
print type(works)
print broken
print works
system.util.jsonEncode(works)
system.util.jsonEncode(broken)
Console Output:
<type 'dict'>
<type 'dict'>
{'racks': [{'sampleCount': 0, 'createdAt': 0, 'trayCode': u'asdfasdf', 'rackType': 1}, {'sampleCount': 0, 'createdAt': 0, 'trayCode': u'qwerqwer', 'rackType': 2}, {'sampleCount': 0, 'createdAt': 0, 'trayCode': u'zxcvzxcv', 'rackType': 1}]}
{'racks': [{'rackType': 1, 'sampleCount': 0, 'createdAt': 0, 'trayCode': u'asdfasdf'}, {'rackType': 2, 'sampleCount': 0, 'createdAt': 0, 'trayCode': u'qwerqwer'}, {'rackType': 1, 'sampleCount': 0, 'createdAt': 0, 'trayCode': u'zxcvzxcv'}]}
u'{"racks":[{"sampleCount":0,"createdAt":0,"trayCode":"asdfasdf","rackType":1},{"sampleCount":0,"createdAt":0,"trayCode":"qwerqwer","rackType":2},{"sampleCount":0,"createdAt":0,"trayCode":"zxcvzxcv","rackType":1}]}'
Traceback (most recent call last):
File "<buffer>", line 34, in <module>
RuntimeError: maximum recursion depth exceeded