public static void Main()
var obj = JsonConvert.DeserializeObject<RootObject>(json,
new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.All });
Console.WriteLine(JsonConvert.SerializeObject(obj, Formatting.Indented));
Console.WriteLine("\nSERIALIZED WITH REFERENCES PRESERVED:\n");
Console.WriteLine(JsonConvert.SerializeObject(obj, Formatting.Indented,
new JsonSerializerSettings { PreserveReferencesHandling = PreserveReferencesHandling.Objects }));
static string GetJson() {
""StyleName"": ""Standard"",
public string StyleName { get; set; }
public StyleRoot Style { get; set; }
public Style ShapeStyle { get; set; }
public Style RightEndCapsStyle { get; set; }
public Background Background { get; set; }
public Color Color { get; set; }
public int A { get; set; }
public int R { get; set; }
public int G { get; set; }
public int B { get; set; }