Need help to update/create values at runtime in Json.net
<p>I've a JSON content and trying to add new property after deserializing to custom object using Json.net. After creating new property, it is not updating its reference type. I'm not sure what I'm missing here. Can anyone help?</p>

<p>This is base class which inherits Dictionary type.</p>

<pre><code>&lt;!-- language: c# --&gt;

public abstract class BaseData : Dictionary&lt;string, object&gt;
{
    public string ID
       { get { return this["Id"] as string; } }

    public string Title
        { get { return this["Title"] as string; } }
}
</code></pre>

<p>This is my page class</p>

<pre><code>public class CPage : BaseData
{
    public CPage(){ }

    public CPageTemplate PageTemplate
    {
        get { return (this["PageTemplate"] as JObject).ToObject&lt;CPageTemplate&gt;(); }
    }
}
</code></pre>

<p>This is my template class</p>

<pre><code>public class CPageTemplate : BaseData
{
    public CPageTemplate(){}

    public CPageTemplate(PageTemplate pt)
    {
        this.Add("Id", pt.Id.ToString());
        this.Add("Title", pt.Title);
    }       
}
</code></pre>

<p>JSON content is </p>

<pre><code>{
  "Id": "P_1",
  "Title": "enrolled",
  "PageTemplate": {
    "Id": "PT_1",
    "Title": "PageTemplate Transform"
  }  
}
</code></pre>

<p>Usage is below</p>

<pre><code>       JObject jo = JObject.Parse(File.ReadAllText(@"stack.json"));        
       CPage cPage = JsonConvert.DeserializeObject&lt;CPage&gt;(jo.ToString());

       cPage["Id"] = "C_1"; // works correctly 
       cPage.PageTemplate["Dynamic"] = true; // not able to retrieve
</code></pre>

<p>After setting "Dynamic" property, if i read cPage object, i couldn't find "Dynamic" key. Same thing is happening while changing the values for existing "Id" or "Title" properties. Even after I'm updating, i can see only old values.</p>

<p>Also, If i update Id of Page object, i'm able to retrieve it cPage object. Any changes in <em>PageTemplate</em> is not getting reflected. </p>

<p>Can anyone help me on this?</p>