title: How to serialize empty arrays when converting to XML with Json.Net
body: <p>I need to convert some Json to XML but when I do it removes all empty arrays/list/collections/etc...</p>
  
  <p>How can I get it to include the arrays as empty items?</p>
  
  <p>Example Json:</p>
  
  <pre><code>{ 
    "EmptyCollection": [], 
    "OtherPorperty\": "TestValue" 
  }
  </code></pre>
  
  <p>C# Code:</p>
  
  <pre><code>var jsonString = "{ \"EmptyCollection\": [], \"OtherPorperty\":\"TestValue\" }";
  
  
  var xmlDoc = JsonConvert.DeserializeXmlNode(jsonString, "root", true);
  Console.WriteLine(xmlDoc.InnerXml);
  </code></pre>
  
  <p>Actual result is </p>
  
  <pre><code>&lt;root&gt;
    &lt;OtherPorperty&gt;TestValue&lt;/OtherPorperty&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Desired result is </p>
  
  <pre><code>&lt;root&gt;
    &lt;EmptyCollection&gt;&lt;/EmptyCollection&gt;
    &lt;OtherPorperty&gt;TestValue&lt;/OtherPorperty&gt;
  &lt;/root&gt; 
  
  or 
  
  &lt;root&gt;
    &lt;EmptyCollection /&gt;
    &lt;OtherPorperty&gt;TestValue&lt;/OtherPorperty&gt;
  &lt;/root&gt;
  </code></pre>
  
  <p>Using the writeArrayAtribute doesn't seem to work.</p>