title: Help with design of DataContract for my WCF JSON service
body: <p>I’m writing a WCF service that returns data in JSON format to clients.
  I would like to output JSON which looks like follows</p>
  
  <p>{
    22877: {
      id: "22877",
      name: "Foo Bar",
      type: "user",
      activities: {
        data: [
        ]
      }
    }
    405564: {
      id: "405564",
      name: "Bar Foo",
      type: "user",
      activities: {
        data: [
        ]
      }
    }
  }</p>
  
  <p>I’m having a hard time to come up with a class/DataContract that will be Serialized to the above format by WCF JSON service.</p>
  
  <p>I tried the following</p>
  
  <pre><code>[DataContract]
  internal class Person
  {
      [DataMember]
      internal string id;
  
      [DataMember]
      internal string name;
  
      [DataMember]
      internal string type;
  
      [DataMember]
      internal Activities activities;
  }
  
  [DataContract]
  internal class Activities
  {
      [DataMember(Name = "data")]
      internal List&lt;Activity&gt; activity;
  }
  
  [DataContract]
  internal class Activity
  {
      internal string name;
  }
  </code></pre>
  
  <p>When I return List of Persons from my WCF method, the JSON response looks as follows</p>
  
  <p>[{"activities":{"data":[{}]},"id":"1234","name":"John","type":"user"},{"activities":{"data":[{}]},"id":"1234","name":"John","type":"user"}]</p>
  
  <p>Any suggestions on how to get “id” (which is dynamic) as a key for each of the inner JSON objects and have {} brackets for a collection of items instead of [] ?</p>