title: Convert key=value string to JSON
body: <p>I have a string of keys and values in the following format:</p>
  
  <pre><code>KEY1=someValue, KEY2="Hello, World!", SOME.OTHER.KEY=Hello World!, KEY4="Hello, ""World""!"
  </code></pre>
  
  <p>How can I convert it into a JSON string using C#? This can probably be done using a Regex, but I can't come up with the right pattern. Neither was I able to figure out how to do it using libraries like <code>Newtonsoft.Json</code>.</p>
  
  <p>The JSON I want to produce is the following:</p>
  
  <pre><code>{
      "KEY1":"someValue",
      "KEY2":"Hello, World!",
      "SOME.OTHER.KEY":"Hello World!",
      "KEY4":"Hello, \"World\"!" 
  }
  </code></pre>