Add JSON Package Reference; new to Java

心已入冬 提交于 2019-12-03 05:42:31

This is a wrong download I believe. You need JSON-Simple library from here http://code.google.com/p/json-simple/ . Your link points to another implementation.

After download the *.jar should be added to the classpath. How you do it depends on the tools you use. In Eclipse it is right-click on the project, Properties->Libraries and add the new JAR.

  • Right click on the Eclipse project,
  • choose Properties
  • Select Java Build Path
  • Click the libraries tab
  • click add external jars
  • find the json jar(s) and add them.

Hey just download the json.jar from this website

http://www.java2s.com/Code/Jar/j/Downloadjsonsimple11jar.htm

after that

  • right click on your eclipse project then
  • choose Properties of that folder
  • Select Java Build Path Click the libraries tab
  • click add external jars

find the json jar(s) and add them.

import java.io.FileReader;
import java.util.Iterator;

import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;

and add these package in your java file :)

Be advised: Json and JsonSimple are not the same. If you are using Maven you can get json-simple by adding this dependency to your pom file:

http://mvnrepository.com/artifact/com.googlecode.json-simple/json-simple/1.1.1

<dependency>
    <groupId>com.googlecode.json-simple</groupId>
    <artifactId>json-simple</artifactId>
    <version>1.1.1</version>
</dependency>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!