title: How to Serialize XML to a JSON object with Json.NET
body: <p>I can serialize XML to a JSON string like this:</p>
  
  <pre><code>var xml = new XmlDocument();
  xml.LoadXml("&lt;person&gt;&lt;name&gt;John&lt;/name&gt;&lt;/person&gt;");
  string jsonString = Newtonsoft.Json.JsonConvert.SerializeXmlNode(xml, Newtonsoft.Json.Formatting.None);
  Response.ContentType = "application/json";
  Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(jsonString));
  </code></pre>
  
  <p>That would give me:</p>
  
  <pre><code>"{\"person\":{\"name\":\"John\"}}"
  </code></pre>
  
  <p>But how can I serialize it to a JSON object? Like this:</p>
  
  <pre><code>{"person":{"name":"John"}}
  </code></pre>