Proper to_json/from_json serialization