RealSelf interview question

How would you go about serializing/deserializing a tree?