Home > Web Front-end > JS Tutorial > jQuery jqgrid's Java processing method for json data containing special characters_jquery

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

WBOY
Release: 2016-05-16 18:12:49
Original
1085 people have browsed it

I saw that a lot of online processing of json data containing special characters involves determining 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:

Copy the code Code As follows:

import net.sf.json.util.JSONUtils;

String str = (String) value;
String s1 = JSONUtils.quote(str);/ /With first and last quotation marks
String s3 = JSONUtils.stripQuotes(s1);//Remove the first quotation mark
return s3;

This code is very concise.
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template