Home  >  Article  >  Java  >  jQuery jqgrid's Java processing method for json data containing special characters

jQuery jqgrid's Java processing method for json data containing special characters

高洛峰
高洛峰Original
2017-01-19 15:19:201443browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn