我需要将一些大使API的字段映射到C#。
API输出如下:
"data": {
"ambassadors": [],
"company": {
"company_name": "Trupanion Managers USA, Inc.",
"company_url": "",
"company_email": "gina.pizzalato@trupanion.com",
"point_name": "points",
"outgoing_email": "",
"avatar_url": "https://ambassador-api.s3.amazonaws.com/generic_avatar.png"
}
C#如下:
public class Company
{
public string CompanyName { get; set; }
public string CompanyUrl { get; set; }
public string CompanyEmail { get; set; }
public string PointName { get; set; }
public string OutgoingEmail { get; set; }
public string AvatarUrl { get; set; }
}
道格说要看一下Marketo并使用PostIocBootstrapConfiguration来配置JsonSettings,就像这样:
this.jsonSerializerSettings.SetFor<MarketoTokenResponse>(new JsonSerializerSettings
{
UseSnakeCasePropertyNames = true
});
但是它不起作用。
还有更多吗?
是否需要添加app.config或引用?