Online to find the method of escape Public static string ReplaceString (string JsonString) { If (JsonString==null) {return JsonString; } If (JsonString. The Contains (" \ \ ")) { JsonString=JsonString. Replace (" \ \ ", \ \ \ \ ""); } If (JsonString. Contains (" \ "")) { JsonString=JsonString. Replace (" \ ""," \ \ \ '"); } If (JsonString. Contains (" \ "")) { JsonString=JsonString. Replace (" \ ""," \ \ \ ""); } //remove the string enter a newlineJsonString=Regex. Replace (JsonString, @ "[\ n \ r]", ""); JsonString=JsonString. The Trim (); Return JsonString; }
But returned as a result, the result directly put the Json parser also impassability, escaped with so? [{\ "FNumber " : \ "1.232.12 ", \ "FName " : abcdf \ 'wwewe/wewe \ \ \ "we "}, {\ "FNumber " : \ "232323 " and \ "FName " : \ "and " loudly}, {\ "FNumber " : \ "343434 " and \ "FName " : \ WWW \ ""}, {" FNumber \ ": " 1212 \ "and " FName \ ": " then loudly sympathy fee qwwwew \ "}, {\ "FNumber " : \ "45354545 " and \ "FName " : \ "wewewe \ wewewe \}]
CodePudding user response:
You have to deal with the source, not in the replacement after get the json, not too many questions, written by normal web API interface, returns this object collection, automatic is serialized, also do not have what difficulty, you this is the string concatenation? To modify the code, I return the right way is