Serializing objects to JSON and back using RTTI