没有这个元素造成的。
问题代码:

value = jsonObject.get(entry).toString();

分析原因:

json中没有这个key,更没有这个key所对应的值

解决办法:判断一下是否有这个key,没有就加入,并添加所对应的值

if(!jsonObject.has(entry)){
value = "null";
}
else {
value = jsonObject.get(entry).toString();
}

org.json.JSONException: JSONObject["shophours"] not found.的更多相关文章

  1. Json_异常_net.sf.json.JSONException: JSONObject["solution"] not found.

    net.sf.json.JSONException: JSONObject["solution"] not found. 没有这个元素造成的. 问题代码: JSONObject j ...

  2. 大话 JSON 之 JSONObject.getString(“”) 方法 和 JSONObject.optString(“”) 的区别

    运行以下代码: public static void main(String[] args) { JSONObject test = new JSONObject(); test.put(" ...

  3. grails框架中读取txt文件内容将内容转换为json格式,出现异常Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' at character 1 of [...]

    Exception in thread "main" org.json.JSONException: A JSONObject text must begin with '{' a ...

  4. new JSONObject(str)无法解析 报错:org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject

    org.json.JSONException: Value of type java.lang.String cannot be converted to JSONObject 解析服务器返回的Jso ...

  5. org.json.JSONException: A JSONObject text must begin with '{' at character 1 of {解决方法

    在使用java读取一个本地的json配置文件的时候,产生了这个异常:org.json.JSONException: A JSONObject text must begin with '{' at c ...

  6. json数据格式 net.sf.json.JSONException: A JSONObject text must begin with '{' at character 1 of Error:(findColumns1)Read timed out

    substring(3)的用法http://www.w3school.com.cn/jsref/jsref_substring.asp 可能一:sb是要转化的数据,以sb是String为例       ...

  7. bug_ _org.json.JSONException: End of input at character 0 of

    10-16 18:28:39.549: W/System.err(4950): org.json.JSONException: End of input at character 0 of 10-16 ...

  8. atitit.解决net.sf.json.JSONException There is a cycle in the hierarchy

    atitit.解决net.sf.json.JSONException There is a cycle in the hierarchy 1. 环境:使用hibernate4跟个,,要不个哪的对象系列 ...

  9. net.sf.json.JSONException: java.lang.NoSuchMethodException

    在尝试将json对象转换为list时候出现了如下错误 Exception in thread "main" net.sf.json.JSONException: java.lang ...

随机推荐

  1. FJUT3568 中二病也要敲代码(线段树维护区间连续最值)题解

    题意:有一个环,有1~N编号,m次操作,将a位置的值改为b,问你这个环当前最小连续和多少(不能全取也不能不取) 思路:用线段树维护一个区间最值连续和.我们设出两个变量Lmin,Rmin,Mmin表示区 ...

  2. ZOJ 3593 One Person Game(ExGcd + 最优解)题解

    思路:题意转化为求 (ax+by=dis) || (ax+cy=dis) || (bx+cy=dis) 三个式子有解时的最小|x| + |y|.显然求解特解x,y直接用扩展欧几里得,那么怎么求|x| ...

  3. (转)JPA & Restful

    参考博客: JPA: https://www.jianshu.com/p/b6932740f3c0 https://shimo.im/docs/zOer2qMVEggbF33d/ Restful: h ...

  4. 【问题解决:连接异常】 java.lang.ClassCastException: java.math.BigInteger cannot be cast to java.lang.Long

    问题描述: MySQL更新到8.0.11之后连接数据库时会报出错误 Your login attempt was not successful, try again.Reason: Could not ...

  5. awk - group adjacent rows by identical columns

    Liang always brings me interesting quiz questions. Here is one: If i have a table like below: chr1 1 ...

  6. 深度学习课程笔记(一)CNN 卷积神经网络

    深度学习课程笔记(一)CNN 解析篇 相关资料来自:http://speech.ee.ntu.edu.tw/~tlkagk/courses_ML17_2.html 首先提到 Why CNN for I ...

  7. 【ASP.NET】System.Web.Routing - HttpMethodConstraint Class

    你可以自己定义你的ASP.NET程序接收的get post put 或者delete请求. 使用这个约束的方式为: void Application_Start(object sender, Even ...

  8. Katana的WebAPI集成Swagger 解决方案

    这位大哥写的博客很清楚了,我就不重复了. http://www.cnblogs.com/caodaiming/p/4156476.html 错误解决 http://blog.csdn.net/gold ...

  9. 使用explain来分析SQL语句实现优化SQL语句

    用法:explain sql 作用:用于分析sql语句 mysql> explain select * from quser_1 where loginemail = "quctest ...

  10. 【UOJ#196】【BZOJ4574】[Zjoi2016]线段树

    题目链接: http://www.lydsy.com/JudgeOnline/problem.php?id=4574 http://uoj.ac/problem/196 考虑数字随机并且值域够大,我们 ...