using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Json;
namespace Zuga.net
{
[DataContract]
public class President
{
[DataMember] public int Number { get; set; }
[DataMember] public string First { get; set; }
[DataMember] public string Last { get; set; }
[DataMember] public int Year { get; set; }
}
class Program
{
static void Main(string[] args)
{
var serializer = new DataContractJsonSerializer(typeof(President));
var path = "president.json";
using (var fs = new FileStream(path, FileMode.Open))
{
var president = (President)serializer.ReadObject(fs);
}
}
}
}