Therefore, for business reasons, I need to get JSON.NET to avoid a drop of JSON as follows:
{ url: 'http://some.uri/endpoint' }
As
{ "url": "http:\/\/some.uri\/endpoint" }
In other words, he needs to avoid malt characters with a forward slash. I know that the JSON specification does not require this, and technically they are equal, but in this particular situation I need to create the same JSON.NET string as I, from somewhere else.
What is the best way to get JSON.NET to do this?
Would it be wise to create a new subclass of JSONConverter (e.g. MyPedanticStringConverter) and use it like this?
string json = JSONConvert.SerializeObject( myObject, Formatting.None, new MyPedanticStringConverter());
source share