I have a JSONArray called playtitles, and a String called playname. I want to iterate through the JSONArray and check for the String, but JSONArray doesn't have a .contains() function, this is the relevant code:
This is the error I get The method contains(String) is undefined for the type JSONArray
I have tried converting playName to a JSON string but that doesn't seem to work either. I have also tried using an ArrayList and then converting it to a JSONArray but that causes more problems.
Any tips?
I think you need to use the following implementation:
http://json-lib.sourceforge.net/
According to their specification, there is a .contains() method for JSONArray.
http://json-lib.sourceforge.net/apidocs/net/sf/json/JSONArray.html#contains(java.lang.Object)
So the import would be something like :
import net.sf.json.JSONArray;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With