catekr / json-simple

Automatically exported from code.google.com/p/json-simple
Apache License 2.0
0 stars 0 forks source link

Cannot get JSONObject value when key name is "class" #19

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a json object with a java string like so, 
   String jsonStr = "{\"class\":\"test\"}"
2. Parse the string with JSONObject and try to get the value for the key
name class.
   Object obj=parser.parse(jsonStr);
   JSONObject jObj = (JSONObject) obj;
   System.out.println("Key name: class, Key value: " + jObj.get("class"));

What is the expected output? What do you see instead?
I expect to get the value "test" however, it always comes back with a null
value.

What version of the product are you using? On what operating system?
json-simple-1.1.jar on Windows XP.

Please provide any additional information below.

Original issue reported on code.google.com by bangz...@gmail.com on 23 Feb 2010 at 4:16

GoogleCodeExporter commented 8 years ago
Please discard this ticket.  I think I just had my objects casted incorrectly.

Original comment by bangz...@gmail.com on 23 Feb 2010 at 9:12

GoogleCodeExporter commented 8 years ago

Original comment by fangyid...@gmail.com on 24 Feb 2010 at 12:06