Parser mistakes literal string as an array
Brought to you by:
aalmiray
The literal String value of '[]' (without the quotes) gets parsed as an array.
The code below will throw a java.lang.ClassCastException on the 3rd line:
String json = "{\"mystring\" : \"[]\"}";
JSONObject result = JSONObject.fromObject(json);
String s = (String) result.get("mystring");
I think the type of result in the above example should be java.lang.String, not net.sf.json.JSONArray.
Development of this library has been moved to GitHub since 2010, please report any issues you may find at https://github.com/kordamp/json-lib/issues