java判断string字符串是不是json格式

public static boolean isJson(String content) {
        try {
            JSONObject.fromObject(content);
            return true;
        } catch (Exception e) {
            return false;
        }
    }

posted @ 2018-06-08 15:00  晴天fly  阅读(52513)  评论(0编辑  收藏  举报