org.json根据如何检查给定字符串在Java中是否为有效JSON,我找到了解决方案但使用库
public static boolean isJson(String Json) { try { new JSonObject(Json); } catch (JSonException ex) { try { new JSonArray(Json); } catch (JSonException ex1) { return false; } } return true; }现在,随机查找的字符串
bncjbhjfjhj是
false并且
{"status": "UP"}为真。


