I created an ArrayList with the json values from an Rest API.
This is the code to read the Rest API:
@RestController
public class exemploclass {
    
    @RequestMapping(value="/vectors")
    //@Scheduled(fixedRate = 5000)
    public ArrayList<StateVector> getStateVectors() throws Exception {
        
        ArrayList<StateVector> vectors = new ArrayList<>();
        
        String url = "https://opensky-network.org/api/states/all?lamin=41.1&lomin=6.1&lamax=43.1&lomax=8.1";
        //String url = "https://opensky-network.org/api/states/all?lamin=45.8389&lomin=5.9962&lamax=47.8229&lomax=10.5226";
        URL obj = new URL(url);
        HttpURLConnection con = (HttpURLConnection) obj.openConnection();
        // optional default is GET
        con.setRequestMethod("GET");
        //add request header
        con.setRequestProperty("User-Agent", "Mozilla/5.0");
        int responseCode = con.getResponseCode();
        System.out.println("\nSending 'GET' request to URL : " + url);
        System.out.println("Response Code : " + responseCode);
        BufferedReader in = new BufferedReader(
                new InputStreamReader(con.getInputStream()));
        String inputLine;
        StringBuffer response = new StringBuffer();
        while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
        }
        in.close();
        
        
        JSONObject myResponse = new JSONObject(response.toString());
        JSONArray states = myResponse.getJSONArray("states");
        System.out.println("result after Reading JSON Response");
            
        for (int i = 0; i < states.length(); i++) {
            
            JSONArray jsonVector = states.getJSONArray(i);
            String icao24 = jsonVector.optString(0);
            String callsign = jsonVector.optString(1);
            String origin_country = jsonVector.optString(2);
            Boolean on_ground = jsonVector.optBoolean(8);
            
            //System.out.println("icao24: " + icao24 + "| callsign: " + callsign + "| origin_country: " + origin_country + "| on_ground: " + on_ground);
            //System.out.println("\n");
            
            StateVector sv = new StateVector(icao24, callsign, origin_country, on_ground);
            vectors.add(sv);
  
        }
        
        System.out.println("Size of data: " + vectors.size());
        return vectors;
        
    }
}
The last line " return vectors;" returns a list with the values i parsed and returns it like this:

But i want this more "pretty", i want it to be one Array in each line, how can i achieve this?
P.S. Its on the .html page, not on console
 
    