response返回的文件流跟json格式是不一样的,所以我们可以用下面方法,判断json来确定。
public static boolean isJSON2(String str) {
boolean result = false;
try {
Object obj = JSON.parse(str);
result = true;
} catch (Exception e) {
result = false;
}
return result;
}