C # line string for assembly with semicolons in data

I create a line as follows:

string title = "Q: hello";

Then I want to insert this string into a JSON string to send to the client. How to avoid semicolon? I do not want to use the library.

Thank.

+3
source share
2 answers

According to the specification, only characters that need escaping are ", \ and a control character:

\"
\\
\/
\b
\f
\n
\r
\t

therefore you do not need to avoid the semicolon in the Json line. Link: http://www.json.org/ (on the right side)

+1
source

Try using the backslash http://json.org/

, JavaScriptSerializer http://msdn.microsoft.com/en-us/library/system.web.script.serialization.javascriptserializer.aspx

.net, . ( System.Web.Extensions)

0

All Articles