Issue 96 in json-simple: nothing is being converted to a JSONObject in my java class, throwing an exception

8 views
Skip to first unread message

json-...@googlecode.com

unread,
Jul 9, 2014, 12:20:48 PM7/9/14
to json-...@googlegroups.com
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 96 by Tyler.sa...@gmail.com: nothing is being converted to a
JSONObject in my java class, throwing an exception
http://code.google.com/p/json-simple/issues/detail?id=96

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


--
You received this message because this project is configured to send all
issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

json-...@googlecode.com

unread,
Jul 14, 2014, 11:08:20 PM7/14/14
to json-...@googlegroups.com
Updates:
Status: Invalid

Comment #1 on issue 96 by fangyid...@gmail.com: nothing is being converted
to a JSONObject in my java class, throwing an exception
http://code.google.com/p/json-simple/issues/detail?id=96

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

See "https://code.google.com/p/json-simple/wiki/DecodingExamples" for more
details.
Reply all
Reply to author
Forward
0 new messages