JSONObject 试错

前端之家收集整理的这篇文章主要介绍了JSONObject 试错前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
    public static void main(String[] args) {
        String context = "\"{\"business_scene\":\"scanApp\"}";
        JSONObject jsonMap = JSONObject.fromObject(context);
        System.out.println(ToStringBuilder.reflectionToString(jsonMap));
    }


Exception in thread "main" net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of "{"business_scene":"scanApp"}
	at net.sf.json.util.JSONTokener.SyntaxError(JSONTokener.java:512)
	at net.sf.json.JSONObject._fromJSONTokener(JSONObject.java:1096)
	at net.sf.json.JSONObject._fromString(JSONObject.java:1317)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:185)
	at net.sf.json.JSONObject.fromObject(JSONObject.java:154)
原文链接:https://www.f2er.com/json/289762.html

猜你在找的Json相关文章