I have to work with an old product that takes strings as the response from calling outside websites. Its not JSON or XML types. Even though the data is an xml string.
The issue is that my WebAPI is sending back the escape characters for c# in the returned value. for example \"1.0\" that is the raw string returned. Is there a way to get rid of the escape characters in the returned response? This seems simple enough. Maybe an attribute on the api call.
public class DumpController : ApiController
{
public string Get()
{
var myobject = new OrderPackage();
myobject.Shipper = "something here";
myobject.ShippingMethod = "So jones said \" this is not right \"";
myobject.TrackingId = "19199n99fuajf";
myobject.Id = 1;
var result = Utility.GenericFunctions.ToXml(myobject, myobject.GetType());
return result;
}
}
[Serializable()]
public class OrderPackage
{
public int Id { get; set; }
public int OrderId { get; set; }
public string TrackingId { get; set; }
public Nullable<System.DateTime> PickupDate { get; set; }
public string Shipper { get; set; }
public string ShippingMethod { get; set; }
public string PackageCreatorId { get; set; }
public string CartPackageId { get; set; }
}
Raw returned string:
"<?xml version=\"1.0\" encoding=\"utf-8\"?><q1:OrderPackage......
I need it not to print the \ character.