/**
* 判断字符串是否可以转化为json对象
* @param content
* @return
*/
import net.minidev.json.JSONObject;
import net.minidev.json.JSONValue;
public static boolean isJsonObject(String content) {
// 字符串判空
if(StringUtils.isBlank(content))
return false;
try {
JSONObject jsonStr = (JSONObject) JSONValue.parse(content);
return true;
} catch (Exception e) {
return false;
}
}
Java determines whether the string can be converted to json
Guess you like
Origin blog.csdn.net/qq_42258975/article/details/112868852
Recommended
Ranking