serialize each object with id