I'm having some issues consuming a JSON API in Android Studio I've been watching and reading about a lot of examples, but still can't figure out how to extract the data I need...
After some hours, I have finally gotten to the point were I figured to extract:
JSONObject subObj = jsonObject.getJSONObject("response");
With the following contents:
{
    "hereNow": {
    "count": 1,
    "items": [
      {
        "id": "xxxxxxxxxx",
        "createdAt": xxxxxxxxxx,
        "type": "checkin",
        "timeZoneOffset": 60,
        "user": {
          "id": "xxxxxxx",
          "firstName": "xxxxxxxx",
          "lastName": "xxxxxxxxxx",
          "gender": "male",
          "relationship": "friend",
          "photo": {
            "prefix": "xxxxxxxxx",
            "suffix": "xxxxxxxxxx"
          }
        },
        "likes": {
          "count": 0,
          "groups": [
      ]
    },
    "like": false
      }
    ]
  }
}
The problem now is: How to extract the user object? I've been trying a lot of things with
JSONObject
and
JSONArray
But I keep on getting this:
Attempt to invoke virtual method 'org.json.JSONArray org.json.JSONObject.getJSONArray(java.lang.String)' on a null object reference
Can someone please help me? Please don't redirect me to another topic, because in general I understand JSON, just not in this particular case...
Thanks in advance.
 
    