[Description]
1. Using Java
2. Use org.json.JSONArray and org.json.JSONObject
[Problem]
When I call JSONArray's remove()
method, always get "cannot find symbol: method remove(int)" when compile my project, any help for this?
Here is a similar question: How to remove JSONArray element using Java
but the answer seems not correct, because that will just remove the inside JSONObject's key-value pair but not the whole insinde JSONObject.
Example code:
JSONArray test_arr = new JSONArray("[{'id':'1', 'name': 'name1'},{'id':'2', 'name':'name2'}]");
test_arr.remove(1); // here will cause the "cannot find symbol" error.
Thanks in advance for any help.