I'm consuming a web service that returns JSON data, and in numerous cases the services returns several properties in one object that I would like to group into a class on the C# side. Consider a class structure like:
class Person
{
public Address Address { get; set; }
public string Name { get; set; }
}
class Address
{
public string StreetAddress { get; set; }
public string City { get; set; }
public string ZipCode { get; set; }
}
And JSON data like:
{ "Name" : "Pilchie",
"StreetAddress" : "1234 Random St",
"City" : "Nowheretown",
"Zip" : "12345"
}
Is it possible to attribute my Person and Address classes so that they serialize/deserialize into this format?