I\'m trying to serialize a list of python objects with JSON (using simplejson) and am getting the error that the object \"is not JSON serializable\".
The class is a
This is kind of hackish and I'm sure there's probably a lot that can be wrong with it. However, I was producing a simple script and I ran the issue that I did not want to subclass my json serializer to serialize a list of model objects. I ended up using list comprehension
Let: assets = list of modelobjects
Code:
myJson = json.dumps([x.__dict__ for x in assets])
So far seems to have worked charmingly for my needs