There are regular user input strings in the JSON string, and a lot of rich Text style tags (users cannot see directly, click the HTML Source button in the rich Text editor to see), such as the following:
<p><strong> Rich Text <>SAD<SPAN>ADZX I am user input </strong></p>
<p><span><span style= "font-family: Microsoft Black, & #39; Microsoft yahei& #39;;;" > Rich Text <>sad<span>adzx I'm a user input </span><br/></span></p>
For example, in this case, you need to send the above string through a JSON format, post to the server side, assuming that the string is assigned to variable a:
The structure of the post parameters is this:
{"params": {"Content": A}}
The premise is that the text content of the back-end post needs to contain rich text styles, which is why the Rich text editor is used for the purpose.
It can be noted that the above string, the black bold part, the Rich text editor will automatically do the encodehtml operation, that is, the regular user input string, and the red word part is the Rich Text style label section.
In the sample, the rich Text area contains: <span style= "font-family: Microsoft Black, & #39; Microsoft yahei& #39;;;" > This string, because the JSON format used to back-end post data, so need to pay attention to escape the double quotation mark ", otherwise it will cause the back-end parsing JSON error, so do a bit of escaping, the single double quotation marks into the \\\" This form (because it also involves the operation of encodeURI and decodeURI).
At the same time, the user may enter a single or multiple \ backslash (escape character), so it is also the same escape processing, the individual backslash, into the form of \\\\.
In the final analysis, JSON is used to post large amounts of data (Rich text data) to the server, so it involves the handling of two special characters, double quotes and backslashes.
When using JSON strings to return large amounts of rich text data to the server, you need to be aware of the problems that have been encountered during the recent development.