Created
April 15, 2016 11:52
-
-
Save beachside-project/ad62ffea9f640dd939db2c5ed79c7d3c to your computer and use it in GitHub Desktop.
jsonDemo_person2_attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Person | |
{ | |
[JsonProperty(PropertyName = "firstName")] | |
public string FirstName { get; set; } | |
[JsonProperty(PropertyName = "lastName")] | |
public string LastName { get; set; } | |
[JsonProperty(PropertyName = "age")] | |
public int Age { get; set; } | |
[JsonProperty(PropertyName = "favorites")] | |
public string[] Favorites { get; set; } | |
[JsonProperty(PropertyName = "phones")] | |
public List<Phone> Phones { get; set; } | |
[JsonIgnore] | |
[JsonProperty(PropertyName = "fullName")] | |
public string FullName => $"{FirstName} {LastName}"; | |
} | |
public class Phone | |
{ | |
[JsonProperty(PropertyName = "phoneNumber")] | |
public string PhoneNumber { get; set; } | |
[JsonProperty(PropertyName = "modelName")] | |
public string ModelName { get; set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment