I started coding on leetcode and then opened it in playground and put that code in my local and imported the json jar, but am still seeing the error that Json cannot be resolved.
error line: return Json.value(input).toString();
I have tried the both import jars
import org.json.; import org.json.simple.;
Any help would be greatly appreciated.
Thanks in advance.
public static String stringToString(String input) {
if (input == null) {
return "null";
}
return Json.value(input).toString();
}
If you are trying to run this on leetcode, the jar should be actually present on your application classpath in order for import to work. As a test, try running your code in some IDE like eclipse or Intellij. It will prompt you at compile time about the error.