add to_json and to_xml