using System.Collections.Generic;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json.Serialization;
public static void Main()
""Description"": ""U.S. No 2 Diesel Retail Prices"",
""Manager"": ""Nora Sims"",
""Updated"": ""2014-07-22"",
RootObject root = JsonConvert.DeserializeObject<RootObject>(json);
foreach (Project p in root.Project)
Console.WriteLine("ID: " + p.ID);
Console.WriteLine("Name: " + p.Name);
Console.WriteLine("Description: " + p.Description);
Console.WriteLine("Manager: " + p.Manager);
Console.WriteLine("Dept: " + p.Dept);
Console.WriteLine("Updated: " + p.Updated);
Console.WriteLine("Statistics:");
foreach (Statistic stat in p.Statistics)
Console.WriteLine(" " + stat.ProjectDate.ToString("yyyy-MM-dd") + " - " + stat.Sale);
class StatisticConverter : JsonConverter
public override bool CanConvert(Type objectType)
return (objectType == typeof(Statistic));
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
JArray array = JArray.Load(reader);
ProjectDate = DateTime.ParseExact(array[0].ToString(), "yyyyMMdd",
System.Globalization.CultureInfo.InvariantCulture),
Sale = array[1].ToObject<decimal>()
public override bool CanWrite
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
throw new NotImplementedException();
public List<Project> Project { get; set; }
public string ID { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public string Manager { get; set; }
public string Dept { get; set; }
public string Updated { get; set; }
public List<Statistic> Statistics { get; set; }
[JsonConverter(typeof(StatisticConverter))]
public DateTime ProjectDate { get; set; }
public Decimal Sale { get; set; }