I get data from external json source, which is like below
{"root":{"name":"Haf"eez","skills":["java","j2ee","jquery","ext-js"]}}
How to parse this in java. The word Hafeez has double quote in the center.
After escaping the above i would do
jsonObject = new JSONObject(new JSONTokener(
new InputStreamReader(input)));
Use a backslash to escape. Replace " with \\\\"
Using regex: str.replaceAll("([a-zA-Z0-9])(\\")([a-zA-Z0-9])", "$1\\\\\\\\\\\\\\\\\\"$3");
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.