Code to reproduce:
JsonPrimitive a = new JsonPrimitive("<a href=\"\"/>");
//or the same: JsonPrimitive a = new JsonPrimitive(@"<a href=""/>");
Console.WriteLine(a.ToString());
//or Console.WriteLine((string)a);
//On the console screen I got: "<a href=\""/>"
//Ideal: "<a href=\"\"/>"
The version of my System.Json.dll is 2.0.5.0. Is it a bug? And what’s the solution?
Aug 2015 UPDATE: It’s a bug and already fixed in MONO. Check the link in my answer below.
It’s proved to be a bug in the assembly System.Json of Mono. JsonValue.cs line 218 & 219 in the method
string DoEscapeString (StringBuilder sb, string src, int cur).Original:
Fixed:
reported to mono team.