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

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. 今天的任务--git练习

    克隆远程仓库项目 从版本控制中选择git 填写地址和本地目录,test测试成功后点击clone 克隆完成回到主界面,点击open打开刚才克隆的项目 git操作 添加文件py1.html 打开命令行 新 ...

  2. 题解——洛谷P2781 传教(线段树)

    可以说是数据结构学傻了的典型案例了 昨天跳到这题上 然后思考了一下 噫!好!线段树裸题 然后打完板子,发现\(  n \le 10^9 \) 显然线段树直接做不太行 然后这题又只有普及的难度 然后我就 ...

  3. (转) Dissecting Reinforcement Learning-Part.2

    Dissecting Reinforcement Learning-Part.2 Jan 15, 2017 • Massimiliano Patacchiola 原文链接:https://mpatac ...

  4. ZJOI 2015 幻想乡战略游戏(动态点分治)

    题意 https://loj.ac/problem/2135 思路 首先要明确一点,答案分布是有单调性的.什么意思呢?假设我们的答案在 \(u\) 节点,\((u,v)\) 之间有一条边且 \(u\) ...

  5. springmvc上传zip文件并解压缩代码示例

    <input type="file"  id="file"  name="file"> spring中的配置: <!-- ...

  6. Javascript 日期格式化 相关操作

    1.相关扩展函数 //--------------------------------------------------- // 判断闰年 //--------------------------- ...

  7. RN中关于IOS和Android的相关权限的问题

    在日常的开发中,时常需要去获取应用的一权限 比如查看通讯录/打开摄像机等 1:ios  iOS 的权限管理在info.plist里设置 info.plist主要是管理了app 的一些信息文件,比如版本 ...

  8. BZOJ 3878 【AHOI2014】 奇怪的计算器

    题目链接:奇怪的计算器 如果没有溢出的话,所有的标记都可以在线段树上直接维护,所以一棵线段树就解决问题了. 现在有了溢出,怎么办呢? 发现就算溢出了,各个元素的相对大小关系也是不变的.所以,如果一开始 ...

  9. excel 获取当前日期

    获取第几周(如第12周) ="第"&WEEKNUM(TODAY())&"周" 获取星期几(如星期一) =TEXT(TODAY(),"a ...

  10. Mybatis拦截器(一)

    拦截器需要实现 interceptor接口 public interface Interceptor { //3 对目标对象拦截进行处理的内容 Object intercept(Invocation ...