URLDecoder: Illegal hex characters in escape (%) pattern - For input string: "","
Description of the problem: The above url parsing error occurred when using post to send the json string today, because the % sign is included in the pojo. The workaround is as follows.
pojo = pojo.replaceAll("%(?![0-9a-fA-F]{2})", "%25");
/** * POJO Transform JSON */ public static <T> String getJson(T tResponse) throws Exception{ String pojo = JSONObject.toJSONString (tResponse); pojo = pojo.replaceAll("%(?![0-9a-fA-F]{2})", "%25"); return URLDecoder.decode(pojo, "utf-8"); }