0

I am trying to decode JSON data with Java. I found a library at the following link: http://code.google.com/p/json-simple/wiki/DecodingExamples

I have included the .jar file in the build path in my eclipse project, which added the library under "Referenced Libraries". But when I try to use the library as shown in the first example in the link above, the type is not found.

String s="[0,{\"1\":{\"2\":{\"3\":{\"4\":[5,{\"6\":7}]}}}}]";
Object obj=JSONValue.parse(s);
// Error: JSONValue cannot be resolved

I know this question may be a bit naive, but can someone point out what step I am doing wrong?

The list of imports so far are:

import java.io.DataInputStream;
import java.io.DataOutputStream; 
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLConnection;
import org.json.JSONException;
import org.json.JSONStringer;

Thanks.

Programmer Bruce
67.3k7 gold badges101 silver badges97 bronze badges
asked Nov 25, 2011 at 2:24

2 Answers 2

2

I think you have downloaded json-simple-1.1-bundle.jar, instead, you should download the fourth one:json_simple-1.1.jar

answered Nov 25, 2011 at 2:39
Sign up to request clarification or add additional context in comments.

Comments

0

Did you... forget to import it?

answered Nov 25, 2011 at 2:27

4 Comments

I tried using Ctrl+Shift+O in eclipse but I guess the necessary imports were not added.
@Jake: Did you properly reference the library? Also edit your question and add the exact error message.
I can see the library in the "Referenced libraries" section in my eclipse project folder hierarchy.
@Jake: Could you take a look at the imports yourself and see if it was properly imported? If you're unsure, could you paste all the imports in the question.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.