I've been searching all over the internet for a solution to my problem, but i am very new to Java and have not been able to find an answer that I can understand
I am trying to read a JSON object from a url, lets say it's called http://www.example.com/abc.html , and on that url I have the following JSON code
{ "articles":[ { "title":"example title" , "content":"example content"} ] } I want to be able to get the value of title into a variable.
I have not been able to figure out how to use any of the common JSON parsing libraries and none of my code has worked so far.
Thanks in advance to anyone who can help with either posting some code that has worked for them or maybe posting a link to simple tutorial (however I have not been able to find any simple ones)
java-json.jarand copy it in your project directory. Now you can add it to your project as a library. This can either be done with your IDE (NetBeans, Eclipse) which is really easy: right click on your projects folder and choose "properties" > "Libraries" > "add Jar". Or you can compile your Javap-Program in the command line by using the "-cp" option like this:javac -cp ".;java-json.jar" MyProgram.java. The goal is to tell Java where to find the new JSON classes from the library (e.g.JSONArray, JSONObject...