Hi, indeed these objects are not serializable with the well known Python's JSON serializers. I would suggest you jsonpickle that allows the serialization that you need: http://jsonpickle.github.io/
good luck! -Francesco On 11 January 2014 18:46, Marco Olimpi <badst...@gmail.com> wrote: > Hi, > i'm traing to serialize my called in python. This is my example: > I have this two classes: > > *class User():* > * def __init__(self, _name, _lastname):* > * self.Name = _name* > * self.LastName = _lastname* > > *class News():* > * def __init__(self, _news,_user):* > * self.News = _news* > * self.User = _user* > > > than i create my class in my code: > > ... > *myUser = User("Mario","Rossi")* > *myNews = News("My last news", myUser)* > > *JSONstring = dumps(myNews)* > ... > > but in the last line of code i get the error that the News class is not > JSON serializable. > > How I can make this work? > > Thanks. > > Regards > > Marco > > _______________________________________________ > Python mailing list > Python@lists.python.it > http://lists.python.it/mailman/listinfo/python > >
_______________________________________________ Python mailing list Python@lists.python.it http://lists.python.it/mailman/listinfo/python