public static JSONObject QueryData(Socket s) {
        JSONObject query = new JSONObject(); //sent to server
        JSONObject params = new JSONObject(); //placed into object sent to server
        JSONObject returned = new JSONObject(); //from server
        JSONArray group_ids = new JSONArray(); //all of the required data from specified group ID's
        JSONArray types = new JSONArray();

        String input = "";

        /*Group ids*/
        System.out.println("Please enter in the groups to query by their group ids separated by a space. Leave blank for all (Enter to confirm):");
        input = (new Scanner(System.in)).nextLine();
        if (input.length() > 0) { //if no groups specified, gets all the data based on other filters
            String[] group_idArr = input.split(" ");
            for (String i : group_idArr) {
                if (isInteger(i)) { //checking valid integers in the array
                    group_ids.put(Integer.parseInt(i));
                } else {
                    System.out.println(i + " is not an integer, ignoring.");
                }
            }
            params.put("group_ids", group_ids);
        }

        /*Time from*/
        System.out.println("Please enter the time from which you want readings. Leave blank for all (yyyy-mm-dd hh:mm:ss):");
        input = (new Scanner(System.in)).nextLine();
        if (input.length() > 0) { //if no groups specified, gets all the data based on other filters
            params.put("time_from", input);
        }

        /*Time to*/
        System.out.println("Please enter the time to which you want readings. Leave blank for all (yyyy-mm-dd hh:mm:ss):");
        input = (new Scanner(System.in)).nextLine();
        if (input.length() > 0) {
            params.put("time_to", input);
        }

        /*Types*/
        System.out.println("Please enter which types of readings you want to query, separated by a space. Leave blank for all (\"light\", \"temperature\", \"humidity\"):");
        input = (new Scanner(System.in)).nextLine();
        if (input.length() > 0) {
            String[] typesArr = input.split(" ");
            for (String i : typesArr) {
                types.put(i); //placing the types requested into JSONArray
            }
            params.put("types", types);
        }
        //creating JSONObject to be sent to the server
        query.put("method", "query_readings");
        query.put("group_id", group_id);
        query.put("params", params);

        JSONObject reply = new JSONObject(GetReplyFromServer(query, s)); //reply from server

        return reply;
    }