Python webApp2 json.encode Object within another Object Error -
i unsure why not being able json encode object has object within it. below have added declarations of 2 classes.
#bam class object class bam(object): def __init__(self, name, id, test): self.name = name self.id = id self.test = test # test class object class test(object): def __init__(self, test_name): self.test_name = test_name
this having issues. when json.encode following error: main.test not json serializable.
objtest = test('hay!') objbam= bam('hi', 1, objtest) self.response.write(json.encode(objbam.__dict__))
any feedback appreciated.
thanks in advanced.
Comments
Post a Comment