Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nothing is being converted to a JSONObject in my java class, throwing an exception #96

Closed
GoogleCodeExporter opened this issue Mar 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. String ArrayString= jsonarraystring.get(0); // holds an object
2. JSONObject jo= (JSONObject) ArrayString // always throws string cannot be 
converted to JSON object exception
3. String uname= jo.get("password").toString(); String pass= 
jo.get("username").toString();

What is the expected output? What do you see instead?
I expect to extract the the values of username and password and manipulate them 
and use them in my java program. what I see is : java.lang.ClassCastException: 
java.lang.String cannot be cast to org.json.simple.JSONObject

What version of the product are you using? On what operating system?

Json-simple 1.1.1, Windows 7
Please provide any additional information below.
s

Original issue reported on code.google.com by Tyler.sa...@gmail.com on 9 Jul 2014 at 4:20

@GoogleCodeExporter
Copy link
Author

Use:
JSONObject jo = (JSONObject)JSONValue.parse(ArrayString);

See "https://code.google.com/p/json-simple/wiki/DecodingExamples" for more 
details.

Original comment by fangyid...@gmail.com on 15 Jul 2014 at 3:08

  • Changed state: Invalid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant