title: Serializing an object array to JSON
body: <p>I have a type which is a wrapper over a dictionary - basically a key/value store. I would like to serialize an array of objects of this type to JSON. I am pretty new to JSON and Json.NET (newtonsoft.json).</p>
  
  <p>My type has a method called - ToJson which serializes its dictionary to json as follows</p>
  
  <pre><code>public string ToJson()
  {
    return JsonConvert.SerializeObject(this.values);
  }    
  </code></pre>
  
  <p>And then I try to serialize an array of these objects</p>
  
  <pre><code>var json = JsonConvert.SerializeObject(objectArray)
  </code></pre>
  
  <p>Of course this does not work because each object in the array is serialized and I do not know how to direct the serialization process to my 'ToJson' method for each object. </p>
  
  <p>I can get it to work exactly as I want it if I pass in an array of Dictionary objects.</p>
  
  <p>Maybe I am missing some serialization attribute?</p>
  
  <p>EDIT:</p>
  
  <p>After reading some more documentation I tried a shorter way (before considering the JsonConverter approach) - using the 'JsonPropertyAttribute'. Applying it to the private Dictionary member almost did the job except that I also get the member name serialized, which I do not want. Any way to just serialize the member value and not the member name by using the JsonPropertyAttribute?</p>