jsonobject IllegalAccessException can not access member of class java.util.HashMap modifiers private
posted 5 years ago
I am getting the following error while creating a JSONObject:
Caused by: java.lang.IllegalAccessException: Class org.json.JSONObject can not access a member of class java.util.HashMap with modifiers "private"
The DTO has 3 properties:
The error is thrown while creating a JSON object at:
where object is the DTO object.
Not sure what am I doing wrong here or missing something. If i just have the list as the property then it works fine.
I would really appreciate any pointers to the soln.
That code doesn't compile. list should be uppercase and HashMapMap isn't a class name. While it is obvious what is intended, I wonder if you are somehow pointing to other classes. Or your example is different than the one posted. The following works just fine. Try changing it to your one line at a time to see where the error gets introduced.