I have seen that many online processing of json data containing special characters determine which special characters they are one by one, such as how to handle carriage returns and how to handle quotation marks. In fact, there is a ready-made code library that can do this. Download json-lib-2.3-jdk15.jar:
import net.sf.json.util.JSONUtils; String str = (String) value; String s1 = JSONUtils.quote(str);//首尾带引号 String s3 = JSONUtils.stripQuotes(s1);//去首位引号 return s3;
This code is very concise.
For more jQuery jqgrid Java processing methods for json data containing special characters, please pay attention to the PHP Chinese website!