0
Newtonsoft Json(Json.Net)を使用してカスタムシリアル化を行うには、いくつかの助けが必要です。私はそれがNewtonsoftを使用して行うことができますどのようにNewtonsoftシリアル化
{
"PersonName":"Name",
"Address1":"Address1",
"City":"City",
"State":"state"
}
:
public class Person
{
[JsonProperty(PropertyName = "PersonName")]
public string Name { get; set; }
[JsonIgnore]
public int Age { get; set; }
public Address PersonAddress { get; set; }
}
public class Address
{
[JsonProperty(PropertyName = "Address1")]
public string Address1 { get; set; }
[JsonIgnore]
public string Address2 { get; set; }
[JsonProperty(PropertyName = "City")]
public string City { get; set; }
[JsonProperty(PropertyName = "State")]
public string State { get; set; }
[JsonIgnore]
public string Country { get; set; }
}
が、私はそれが以下のような出力を返す必要があります上記のクラスをシリアル化する場合:私は、以下のようなクラスを持っていますか?