I use jsonpickle for serializer when i selectall to database, i am going to 
convert list object to json when use jsonpickle for this i get this output:

Codes:


 Session = sessionmaker(bind=connect.ConnectorMySql())
                    ses = Session()
                    lst =  ses.query(pModel).all()
                    return lst


 jsonpickle:

serialized_obj = jsonpickle.encode(lst[0])


output:

{"py/object": "Models.UserModel.", "sa_instance_state": {"py/object": 
"sqlalchemy.orm.state.InstanceState", "py/state": {"instance": {"py/id": 0}, 
"committed_state": {}, "class": {"py/type": "Models.UserModel."}, "manager": 
{"py/object": "sqlalchemy.orm.instrumentation.SerializeManager", "class": 
{"py/type": "Models.UserModel.Student"}}, "key": {"py/tuple": [{"py/type": 
"Models.UserModel.Student"}, {"py/tuple": [1]}]}, "expired_attributes": 
{"py/set": []}}}, "name": "ramin", "fullname": "eee", "password": "1234345", 
"id": 1}


but i need this format json:

{"name": "ramin", "fullname": "eee", "password": "1234345", "id": 1}


do you idea better for this work?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to