参考下面代码:
public static void main(String[] args) {
String text = "{}";
Object obj = JSON.parse(text);
if (obj instanceof JSONObject) {
System.out.println("JSONObject");
}
if (obj instanceof JSONArray) {
System.out.println("JSONArray");
}
}