title: Single Element Nested Arrays in JSON from XML in C#
body: <p>I am working with a JSON object that I am serializing from XML. All the child nodes of the XML need to be serialized as arrays.  I have been trying this for a couple days now and have found nothing, but I have gotten close.  The problem is that JsonConvert.SerializeObject() seems to be seeing this as a single item array, and then removing the [] array indicators in the JSON.  Here is my example of what I have been doing.</p>
  
  <p>The desired result is this:</p>
  
  <pre><code>{"Foo":[{"Bar":[{"This":"stuff"}]}]}
  </code></pre>
  
  <p>What has gotten me the closest so far is something like this...</p>
  
  <pre><code>        XElement bar = new XElement("Bar");
          bar.SetAttributeValue("This", "stuff");
          XElement[] foo = { new XElement("Foo", bar) };
  </code></pre>
  
  <p>But it still is not quite right.  The result I get here after running <code>JsonConvert.SerializeObject(foo)</code> is something like this...</p>
  
  <pre><code>{"Foo":{"Bar":{"This":"stuff"}}}
  </code></pre>
  
  <p>For the API, each child of the parent has to be an array type, even if it only  contains 1 element.  The XML version of this request, which I can't use, looks like this...</p>
  
  <pre><code> &lt;Foo&gt;
    &lt;Bar This="stuff"/&gt;
   &lt;/Foo&gt;
  </code></pre>
  
  <p>I have a feeling I'm overlooking something simple, or making this more complex than it needs to be, but I could really use some help.</p>
  
  <p>Thanks!</p>