I've written a Java Method for an Android Studio (3.0.1) project that creates a JSONObject from a String. Now I've written a JUnit test to test that the JSON object is correct.
The problem is always that the JSONObject is NULL.
For example, I tried running the following code:
String response = "{\"songs\":\"title\"}";
System.out.println(response);
JSONObject submitPlaylistResponse = new JSONObject(response);
System.out.println(submitPlaylistResponse.toString());
The output is:
{"songs":"title"}
null
Why is my JsonObject still null? What am I missing? I feel like I'm missing something trivial/simple.
System.out.println(submitPlaylistResponse.getString("songs"));