
cn.zkdcloud.util.JsonUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of weChat Show documentation
Show all versions of weChat Show documentation
we can use it easy to build weChat
The newest version!
package cn.zkdcloud.util;
import com.alibaba.fastjson.JSONObject;
import org.apache.log4j.Logger;
/**
* 处理json字符串
*
* @author zk
* @version 2017/8/26
*/
public class JsonUtil {
private static Logger logger = Logger.getLogger(JsonUtil.class);
/**
* 检查Http的返回结果
*
* @param jsonStr jsonStr
* @return is Error?
*/
public static boolean isError(String jsonStr) {
return null == jsonStr ? true : isError(JSONObject.parseObject(jsonStr));
}
/**
* 检查Http返回结果
*
* @param status jsonObject
* @return is Error?
*/
public static boolean isError(JSONObject status) {
if (status == null) {
return true;
}
if (null != status.getLong("errcode") && 0 != status.getLong("errcode")) {
logger.error("this request is fail : " + status.getString("errmsg"));
return true;
}
return false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy