using Newtonsoft.Json.Linq;
public static void Main()
Console.WriteLine("--- deserialized from JSON ---");
var root = JsonConvert.DeserializeObject<RootObject>(json);
Console.WriteLine("name = " + root.Name);
Console.WriteLine("settings = " + root.Settings);
Console.WriteLine("--- reserialized to JSON ---");
Console.WriteLine(JsonConvert.SerializeObject(root, Formatting.Indented));
Console.WriteLine("--- reserialized with changed settings ---");
root.Settings = @"{ ""setting3"": ""yes"" }";
Console.WriteLine(JsonConvert.SerializeObject(root, Formatting.Indented));
public string Name { get; set; }
get { return SettingsToken != null ? SettingsToken.ToString(Formatting.None) : null; }
set { SettingsToken = value != null ? JToken.Parse(value) : JValue.CreateNull(); }
[JsonProperty("settings")]
private JToken SettingsToken { get; set; }