xSkrappy
xSkrappy

Reputation: 747

Renaming a Field for JSON output

So I have this class:

public class Foo
{
         public string EmailAddress { get; set; }
 }

I need to make it email_address before i add it in the body of my request

I tried:

[SerializeAs(Name = "email_address")]
public string EmailAddress { get; set; }

but it doesn't work. any thoughts about this?

Upvotes: 1

Views: 1095

Answers (1)

xSkrappy
xSkrappy

Reputation: 747

Fixed , I used

[JsonProperty(PropertyName = "email_address")] 
public string EmailAddress { get; set; }

Upvotes: 7

Related Questions