JSONobject class related processing (formatting away the transfer character)

project

Scan the QR code to read:

KGYXKkFufUOoBTdCI+w0VD1pInVkWdVw9HeRDT8LRRhkwVOiRx1QNgi9jjJSl6Lqm4ZC10L75KIrRTyOSDkZBVdn1MdlzfOxb2sTbZF82Sp3srf0phd3sf\/82HcUm0aF6lal6xAuwVwlVEaX9yZmP68ADQ==


The red font is the transfer character, which cannot be recognized

Use the JSONobject class to format out escape characters


Instructions

String s = "Fields that need to be escaped";
String ss = "{'id':'" +s +  "'}";
JSONobject d = new JSONObject(JSONTokener(ss));
JSONobject dd = d.get("id").toString();

Take it out


Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325732022&siteId=291194637