title: Generate lightweight JSON using DataContractJsonSerializer
body: <p>I'm trying to generate JSON using C# and DataContractJsonSerializer in .Net 3.5. The problem is that I can't figure out how to build the structure correct for the result I need.</p>
  
  <p>I've tried to reproduce PHP's associative arrays using both hashtables, list objects and arraylists but can't figure out how to generate my result in the best way using DataContractJsonSerializer without having to create my own recursive loop for building JSON.</p>
  
  <p>The closest approach is using the a Dictionary &lt; string, Dictionary &lt; string, string>> aproach but the result is too big as I can't "name" the keys.</p>
  
  <p>This is what I get:</p>
  
  <pre><code>[
     {
        "Key":"status",
        "Value":[
           {
              "Key":"value",
              "Value":"ok"
           }
        ]
     },
     {
        "Key":"1",
        "Value":[
           {
              "Key":"name",
              "Value":"Result1"
           },
           {
              "Key":"details",
              "Value":"Result 1 details"
           }
        ]
     },
     {
        "Key":"2",
        "Value":[
           {
              "Key":"name",
              "Value":"Result2"
           },
           {
              "Key":"details",
              "Value":"Result 2 details"
           }
        ]
     },
     {
        "Key":"caller",
        "Value":[
           {
              "Key":"value",
              "Value":"1135345"
           }
        ]
     }
  ]
  </code></pre>
  
  <p>This is what I want:</p>
  
  <pre><code>{
     "status":"ok",
     "response":[
        {
           "id":1,
           "name":"Result1"
           "details":"Result 1 details"
        },
        {
           "id":2,
           "name":"Result2"
           "details":"Result 2 details"
        },
        {
           "id":3,
           "name":"Result3"
           "details":"Result 3 details"
      ],
     "caller":"1135345"
  }
  </code></pre>
  
  <p>Does anybody have a clue how I can generate this piece of JSON using C# without having to load the entire Json.NET framework? I need this to be generated as fast as possible as this project aims to become an site search engine.</p>