字符串转换成JSONObject

public static JSONObject getJSONObject(String str) {
        if (str == null || str.trim().length() == 0) {
            return null;
        }
        JSONObject jsonObject = null;
        try {
            jsonObject = new JSONObject(str);
        } catch (JSONException e) {
            e.printStackTrace(System.err);
        }
        return jsonObject;
    }

版权声明:本文为lishaojun0115原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。