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