added to_json and from_json methods