Just to start off, I'm new to Java. I'm trying to make a notification system for Twitch using their API and an Arduino, and I'm currently stuck at the start pretty much. I am able to access the API and get information, but I don't know how to convert it into something useful. This is my code currently.
public class commandRun {
public static void main(String[] args) {
Process p;
try {
p = Runtime.getRuntime().exec("cmd /c curl -H \"Client-ID: clientID\" -X GET \"https://api.twitch.tv/helix/users/follows?first=1&to_id=channelID\n");
p.waitFor();
BufferedReader reader=new BufferedReader(new InputStreamReader(p.getInputStream()));
String twitchFollower;
while((twitchFollower = reader.readLine()) != null) {
System.out.println(twitchFollower);
}
}
catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
This returns
{
"total": 106,
"data": [
{
"from_id": "followerID",
"from_name": "follower",
"to_id": "channelid",
"to_name": "channel",
"followed_at": "2019-10-06T21:03:03Z"
}
],
"pagination": {
"cursor": "dontknowifthisissensitiveinfo"
}
}
I want to be able to take specific info out of string such as the followers' name.