title: How to convert list of string in key value pair json string response?
body: <p>Below is my list of string :</p>
  
  <pre><code>List&lt;string&gt; mylist = new List&lt;string&gt;(new string[] { "element1", "element2", "element3" });
  </code></pre>
  
  <p>Now i want to return above list in the form of below output to web service :</p>
  
  <pre><code>{
   "element1" : "",
   "element2" : "",
   "element3" : "",
  }
  </code></pre>
  
  <p>I want to display output like below on my website :</p>
  
  <pre><code>{
   "element1" : "",
   "element2" : "",
   "element3" : "",
  }
  </code></pre>
  
  <p>This is how i am doing right now :</p>
  
  <pre><code> string output = "{" + Environment.NewLine;
              foreach (var item in myList)
              {
                  output += $"\"{item}\" : \"\"," + Environment.NewLine;
              }
              output = output.Remove(output.Length - 1) + "}";
  </code></pre>
  
  <p>But when i will have 40-50 records then my loop will run for 40-50 times which i am trying to avoid.</p>
  
  <p>I even tried to use this :</p>
  
  <pre><code> string output = JsonConvert.SerializeObject(myList); 
  </code></pre>
  
  <p>But above is not giving exact output format which i want.</p>
  
  <p>Can anybody please suggest me any better way to do this which will avoid forloop and reduce the code to produce the expected output?</p>