.NET WebAPI Serialization k_BackingField Nastiness

Posted by Micah on Stack Overflow See other posts from Stack Overflow or by Micah
Published on 2012-09-08T20:50:38Z Indexed on 2012/09/09 15:38 UTC
Read the original article Hit count: 1878

When i serialize the following:

[Serializable]
public class Error
{

    public string Status { get; set; }
    public string Message { get; set; }
    public string ErrorReferenceCode { get; set; }
    public List<FriendlyError> Errors { get; set; }
}

I get this disgusting mess:

<ErrorRootOfstring xmlns:i="http://www.w3.org/2001/XMLSchema-instance"   xmlns="http://schemas.datacontract.org/2004/07/Printmee.Api">
<_x003C_Errors_x003E_k__BackingField>
An exception has occurred. Please contact printmee support
</_x003C_Errors_x003E_k__BackingField>
<_x003C_LookupCode_x003E_k__BackingField>988232ec-6bc9-48f3-8116-7ff7c71302dd</_x003C_LookupCode_x003E_k__BackingField>
</ErrorRootOfstring>

What gives? How can i make this pretty? JSON responses also contain the k_BackingField

© Stack Overflow or respective owner

Related posts about serialization

Related posts about asp.net-web-api