Reading JSON from a text file

前端 未结 7 1558
隐瞒了意图╮
隐瞒了意图╮ 2021-02-09 01:30

I know of some JSON libs around and I\'m currently looking into Google-JSON but all I want to achieve is something simple and I want to know what you would suggest.

I wa

7条回答
  •  春和景丽
    2021-02-09 02:11

    As for the error messages.

    C:\Users\Dan\Documents\readJSON\readJ.java:2: cannot find symbol
    symbol  : class json
    location: package org
    import org.json;
          ^
    

    You don't usually name your package the same way the package you want to import, although you can.

    You have to either: 1 name it different, 2.- don't put the import

    C:\Users\Dan\Documents\readJSON\readJ.java:27: cannot find symbol
    symbol  : method JSONObject(java.lang.String)
    location: class org.json.readJ
    JSONObject JsonObj = JSONObject(json);
    

    You're missing a "new" there... it should be new JSONObject(...

提交回复
热议问题