问答详情
源自:3-2 自定义菜单(下)

JSONObject["errcode"] is not a number.

Exception in thread "main" net.sf.json.JSONException: JSONObject["errcode"] is not a number.

at net.sf.json.JSONObject.getInt(JSONObject.java:2174)

at com.imooc.util.WechatUtil.createMenu(WechatUtil.java:222)

at com.imooc.test.WechatTest.main(WechatTest.java:29)


控制台抛出此异常,如何解决?


提问者:unlzh 2018-04-06 17:10

个回答

  • 张超楠
    2018-05-03 11:14:49

    int  result = jsonObject.getInt("errcode");


  • 一粒小松子
    2018-04-18 18:53:46

    我也遇到了这个问题,请问你是如何解决的


  • 宝慕林2396088
    2018-04-07 19:43:30

    json对象需要是个数值,但不是数值类型