Your desired result is invalid JSON. I think what you probably wanted to do is add a few dictionaries to the list, for example:
>>> import json >>> multikeys = [] >>> for i in range(3): ... multikeys.append(dict([(x, x**3) for x in xrange(1, 3)])) ... >>> print json.dumps(multikeys, indent=4) [ { "1": 1, "2": 8 }, { "1": 1, "2": 8 }, { "1": 1, "2": 8 } ]
source share