public void prettyPrintJSON(JSONObject oldJSON){
        try {
            JSONTokener tokener = new JSONTokener(oldJSON.toString()); //tokenize the ugly JSON string
            JSONObject finalResult = new JSONObject(tokener); // convert it to JSON object
            System.out.println(finalResult.toString(4)); // To string method prints it with specified indentation.
        }catch( Exception e){
            System.out.println("exception printing pretty JSON: "+e.getMessage() );
        }
    }