Init
This commit is contained in:
24
src/main/java/com/calebfontenot/Main.java
Normal file
24
src/main/java/com/calebfontenot/Main.java
Normal file
@@ -0,0 +1,24 @@
|
||||
package com.calebfontenot;
|
||||
|
||||
import java.net.*;
|
||||
import java.io.*;
|
||||
|
||||
import org.json.*;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println("CURLing API...");
|
||||
URL url = new URL("https://api.papermc.io/v2/projects");
|
||||
|
||||
try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"))) {
|
||||
for (String line; (line = reader.readLine()) != null; ) {
|
||||
JSONObject json = new JSONObject(line);
|
||||
System.out.println(line);
|
||||
JSONArray projects = json.getJSONArray("projects");
|
||||
for (int i = 0; i < projects.length() - 1; i++) {
|
||||
System.out.println(projects.get(i));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user