I have a String which looks like this
[
{
"Slot": 1,
"Ping": 40,
"Kills": 0,
"Deaths": 0,
"Score": 0,
"Team": "Reb",
"Name": "ascasdasd",
"KeyHash": "",
"IsBanned": false,
"TotalVisits": 34,
"GroupName": "",
"RemoteAddressStr": "",
"DatabaseId": 1412
},
{
"Slot": 3,
"Ping": 116,
"Kills": 0,
"Deaths": 0,
"Score": 0,
"Team": "Reb",
"Name": "",
"KeyHash": "",
"IsBanned": false,
"TotalVisits": 1,
"GroupName": "",
"RemoteAddressStr": "",
"DatabaseId": 8226
}
]
How can I get the size/length of it? In this case it should be 2
I'm not sure if I should parse it to JSONObject/JSONArray first? I've been trying to parse it using GSON Library with no success.
Update
Turns out it was simpler than I thought. I didn't even needed GSON:
int sizeOfJSONArrayString = new JSONArray(jsonString).length();
Thank you for your help!