title: Serialize JSON Dictionary<string, string>
body: <p>I have the following code, I want the end to be JSON that a JQuery autocomplete can read.  </p>
  
  <pre><code>[System.Web.Script.Services.ScriptMethod()]
  [System.Web.Services.WebMethod]
  public static string GetNames(string prefixText, int count)
  {        
       Trie ArtistTrie = (Trie)HttpContext.Current.Cache["CustomersTrie"];
  
       List&lt;string&gt; list = ArtistTrie.GetCompletionList(prefixText, 10);
       Dictionary&lt;string, string&gt; dic = new Dictionary&lt;string, string&gt;();
       foreach (string a in list)
       {
           dic.Add(a, "name");
       }
      string json = JsonConvert.SerializeObject(dic, Formatting.Indented);
      return json;
  
   }
  </code></pre>
  
  <p>The JSON looks like this:</p>
  
  <pre><code>  {
       "the album leaf": "name",
       "the all-american rejects": "name",
       "the allman brothers band": "name",
       "the animals": "name",
       "the antlers": "name",
       "the asteroids galaxy tour": "name",
       "the avett brothers": "name",
       "the band": "name",
       "the beach boys": "name",
       "the beatles": "name"
    }
  </code></pre>
  
  <p>This is backwards, I want </p>
  
  <pre><code>    "name" : "the allman brothers"
  </code></pre>
  
  <p>but....  the dictionary needs a unique key, and identical values are ok,  </p>
  
  <p>What is an easy fix for this , also is this readable from JQuery?</p>