A JSONObject text must begin with '{' at character 1 of 1
2014-09-27 11:03
1631 查看
JSONObject json = JSONObject.fromObject(str);
JSONObject stateJson = (JSONObject) json.get("stateVO");
String code = stateJson.getString("code");
报异常,而结果是返回的json 对象,
![](https://oscdn.geek-share.com/Uploads/Images/Content/202005/06/89ad3a2af60d25a1e87ad41e66ee59bd)
这么写就不 报错
JSONObject json = new JSONObject(result);
// JSONObject json = JSONObject.fromObject(str);
logger.debug("json: "+json);
JSONObject stateJson = json.getJSONObject("stateVO");
int code = Integer.parseInt(stateJson.getString("code"));
JSONObject stateJson = (JSONObject) json.get("stateVO");
String code = stateJson.getString("code");
报异常,而结果是返回的json 对象,
这么写就不 报错
JSONObject json = new JSONObject(result);
// JSONObject json = JSONObject.fromObject(str);
logger.debug("json: "+json);
JSONObject stateJson = json.getJSONObject("stateVO");
int code = Integer.parseInt(stateJson.getString("code"));
相关文章推荐
- json解析异常org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {的解决方法
- JSONObject text must begin with '{' at character 1 of错误解决
- json解析时出现异常org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {的解决方法
- 关于json解析时异常org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {的解决方法
- org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {解决方法
- org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {解决方法
- 【Android开发日记】jsonObject = new JSONObject(info)报错 A JSONObject text must begin with '{' at character
- A JSONObject text must begin with '{' at 1 [character 2 line 1]
- Java中json数据问题.报错 A JSONObject text must begin with '{'
- The Contents.json describing the image set "BG_Email_Textfield.imageset" must start with a top level
- Property with 'retain(or strong)' attribute must be of object type
- json 解析 A JSONArray text must start with '['
- Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option t
- Property with 'retain (or strong)' attribute must be of object type
- Property with 'retain (or strong)' attribute must be of object type
- error:Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and op
- No enclosing instance of type TextRunnable is accessible. Must qualify the allocation with an enclos
- AFNetworking 报错 JSON text did not start with array or object and option to allow fragments not set
- Error Domain=NSCocoaErrorDomain Code=3840 "JSON text did not start with array or object and option
- AFNetworking 关于JSON text did not start with array or object and option to allow fragments not set