URL parsing error

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");
    }

Guess you like

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