using System.Collections.Generic;
public static void Main()
""1994-11-05T08:15:30-05:00 Text1. Text2."",
""1993-12-03T08:15:30-05:00 Text1b. Text2b.""
A a = JsonConvert.DeserializeObject<A>(json);
Console.WriteLine("a: " + a.a);
Console.WriteLine("b: " + a.b);
Console.WriteLine(string.Format("c[{0}] date: {1}", idx, obj.date));
Console.WriteLine(string.Format("c[{0}] text1: {1}", idx, obj.text1));
Console.WriteLine(string.Format("c[{0}] text2: {1}", idx, obj.text2));
public List<CustomObject> c;
[JsonConverter(typeof(ConstructFromStringConverter))]
public CustomObject(string constructString)
string[] parts = constructString.Split(' ');
date = DateTime.Parse(parts[0]);
class ConstructFromStringConverter : JsonConverter
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
ConstructorInfo ctor = objectType.GetConstructor(new Type[] { typeof(string) });
return ctor.Invoke(new object[] { (string)reader.Value });
throw new JsonException(objectType.Name + " does not have a public constructor that accepts a string.");
public override bool CanWrite
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
throw new NotImplementedException();
public override bool CanConvert(Type objectType)