title: Add property dynamically to a json string?
body: <p>I need to add some properties to a json string dynamically. Here is the code I'm using:</p>
  
  <pre><code>// set as empty json object
  RequestMessage = "{}";
  dynamic d = JsonConvert.DeserializeObject(RequestMessage);
  d.Request = JsonConvert.SerializeObject(request);
  d.RequestOptions = JsonConvert.SerializeObject(requestOptions);
  RequestMessage = JsonConvert.SerializeObject(d);
  </code></pre>
  
  <p>This can add Request and RequestOptions to d, then serialize d back to json string.</p>
  
  <p>It works fine if I know the properties' names, in this case, they are Request and RequestOptions.</p>
  
  <p>Question is: is there a way to do this IF the property name is a variable? for example, something like:</p>
  
  <pre><code>private string GetJson(string name, object obj)
  {
      // name is "Request"
      // object is request
      ......
      return RequestMessage;
  }
  </code></pre>
  
  <p>Is it possible? *I'm using .net + newton json.</p>
  
  <p>thanks</p>