serialize

serialize and deserialize function.