public static void prettyPrintJSONResponse(Logger logger, String jsonString) {
        if(logger.isDebugEnabled()) {
            // it can fail...on 404 it usually not a json
            String s;
            try {
                final JsonElement element = new JsonParser().parse(jsonString);
                s = new GsonBuilder().setPrettyPrinting().create().toJson(element);
            } catch(Exception e) {
                s = jsonString;
            }
            
            logger.debug("Received JSON response from Instagram - " + s);
        }
    }
public static void prettyPrintJSONResponse(Logger logger, String jsonString) {
        if(logger.isDebugEnabled()) {
            
            String s;
            try {
                final JsonElement element = new JsonParser().parse(jsonString);
                s = new GsonBuilder().setPrettyPrinting().create().toJson(element);
            } catch(Exception e) {
                s = jsonString;
            }
            
            logger.debug("Received JSON response from Instagram - " + s);
        }
    }
public static void prettyPrintJSONResponse ( Logger logger , String jsonString ) { if ( logger . isDebugEnabled ( ) ) { // it can fail...on 404 it usually not a json String s ; try { final JsonElement element = new JsonParser ( ) . parse ( jsonString ) ; s = new GsonBuilder ( ) . setPrettyPrinting ( ) . create ( ) . toJson ( element ) ; } catch ( Exception e ) { s = jsonString ; } logger . debug ( "Received JSON response from Instagram - " + s ) ; } }
Pretty print the JSON response in the logs

@param logger     the logger instance
@param jsonString the json String which is to be pretty printed.
Pretty print the JSON response in the logs