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

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. ActiveMQ安装使用

    入门: https://www.cnblogs.com/cyfonly/p/6380860.html http://www.uml.org.cn/zjjs/201802111.asp https:// ...

  2. Vue学习四:v-if及v-show指令使用方法

    本文为博主原创,未经允许不得转载: <!DOCTYPE html> <html lang="zh"> <head> <meta http- ...

  3. 51nod 1069 Nim游戏 + BZOJ 1022: [SHOI2008]小约翰的游戏John(Nim游戏和Anti-Nim游戏)

    首先,51nod的那道题就是最简单的尼姆博弈问题. 尼姆博弈主要就是判断奇异局势,现在我们就假设有三个石子堆,最简单的(0,n,n)就是一个奇异局势,因为无论先手怎么拿,后手总是可以在另一堆里拿走相同 ...

  4. springboot集成logback日志

    简介 spring boot内部使用Commons Logging来记录日志,但也保留外部接口可以让一些日志框架来进行实现,例如Java Util Logging,Log4J2还有Logback. 如 ...

  5. Codeforces 785E. Anton and Permutation

    题目链接:http://codeforces.com/problemset/problem/785/E 其实可以CDQ分治... 我们只要用一个数据结构支持单点修改,区间查询比一个数大(小)的数字有多 ...

  6. KMP字符串匹配(模板)

    描述: 给出两个字符串 s1 和 s2 ,其中 s2 为 s1 的子串,求出 s2 在 s1 中所有出现的位置.同时要求输出 s2 的 fail 数组. 思路: KMP模板. 标程: #include ...

  7. CentOS6.5下安装配置MySQL数据库

    一.MySQL简介 说到数据库,我们大多想到的是关系型数据库,比如MySQL.Oracle.SQLServer等等,这些数据库软件在Windows上安装都非常的方便,在Linux上如果要安装数据库,咱 ...

  8. 设计模式(七)Adapter Pattern适配器模式

    适用场景:旧系统的改造升级 实际场景:java.io.InputStreamReader(InputStream)等 1.一个被适配的类 package com.littlepage.AdapterP ...

  9. highchart柱状堆叠图动态数据请求

    $(function () { var options = { chart: { renderTo: 'indoor', type: 'column', }, title: { text: '室内问题 ...

  10. Python Appium 元素定位方法简单介绍

    Python  Appium  元素定位 常用的八种定位方法(与selenium通用) # id定位 driver.find_element_by_id() # name定位 driver.find_ ...