title: How to stringify/normalize json in C# like JSON.stringify() would
body: <p>I wonder if there's a better, less haphazard feeling, way of doing to JSON strings what JSON.Stringify does than this?</p>
  
  <pre><code>string json = "{test: 'test'}";
  var stringified = JsonConvert.SerializeObject(JsonConvert.DeserializeObject&lt;dynamic&gt;(json));
  Console.WriteLine(stringified); //Prints {"test":"test"}
  </code></pre>
  
  <p>It appears there isn't a method kind of <em>normalize</em> the string presentation otherwise in C#. I'm not sure about the new .NET Core 3.0 and its new JSON libraries.</p>
  
  <p>&lt;edit: To make the comments a bit more visible, there can be an interoperability situation to <code>JSON.stringify</code> all input to Javascript strings be it in object notation or already stringified. So I was wondering if there's a better way of doing the processing as the one I noted. Even better if built into the framework already.</p>
  
  <p>A playground can be had at <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify" rel="nofollow noreferrer">MDN Web Docs</a>.</p>
  
  <p>There is one example at <a href="https://github.com/ethereum/wiki/wiki/JavaScript-API#web3tohex" rel="nofollow noreferrer">https://github.com/ethereum/wiki/wiki/JavaScript-API#web3tohex</a> where it appears even the same <code>{test: 'test'}</code> JSON object is first stringified and then HEX encoded. There can be cases in C# too where one is reading strings from other sources and the output needs to be in stringified form regardless.</p>