fangyidong / json-simple

A simple Java toolkit for JSON. You can use json-simple to encode or decode JSON text.
Apache License 2.0
744 stars 340 forks source link

nullpointer when parsing JSON that starts with Array #130

Open laundmo opened 6 years ago

laundmo commented 6 years ago

i'm trying to parse a JSON that starts with a array. [ {...}, {...} ]

although when i try to cast that to a JSONObject i get a nullPointer later on when trying to .get(key) anything

but casting to JSONArray the size of the array is 0 and i get a nullPointer when trying to use .get(0)

my goal is to get the second object.

jredfox commented 5 years ago

this issue is invalid as JSONObject isn't a JSONArray and the parser first returns the JSONArray object not a JSONObject