public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { Newtonsoft.Json.Linq.JObject o = Newtonsoft.Json.Linq.JObject.Load(reader); int size = o.Value <int>("Size"); PieceGrid newPieceGrid = new PieceGrid(size); var pieceGridJson = o.Value <JObject>("PointPieces"); Dictionary <Point, Piece> pointPiecesDictionary = new Dictionary <Point, Piece>(); foreach (KeyValuePair <string, JToken> kvp in pieceGridJson) { Point point = Point.Get(kvp.Key); Piece piece = Piece.Get(kvp.Value.Value <string>()); pointPiecesDictionary.Add(point, piece); } newPieceGrid.Initialize(pointPiecesDictionary); return(newPieceGrid); }