src/main/java/com/github/wnameless/json/base/JsonPrinter.java
public static String minimalPrint(String json) {
    if (json == null) new NullPointerException();
    StringBuilder minimalPrintBuilder = new StringBuilder();

    boolean inQuote = false;
    for (char jsonChar : json.toCharArray()) {
      switch (jsonChar) {
        case '"':
          inQuote = !inQuote;
          minimalPrintBuilder.append(jsonChar);
          break;
        default:
          if (inQuote || !Character.toString(jsonChar).matches("\\s")) {
            minimalPrintBuilder.append(jsonChar);
          }
      }
    }

    return minimalPrintBuilder.toString();
  }
/**
   * Returns a minimal print JSON of any JSON input.
   * 
   * @param json
   *          any JSON
   * @return a minimal print JSON
   */
Returns a minimal print JSON of any JSON input.

@param json
any JSON
@return a minimal print JSON
Returns a minimal print JSON of any JSON input . @param json any JSON @return a minimal print JSON
public static String minimalPrint(String json) {
    if (json == null) new NullPointerException();
    StringBuilder minimalPrintBuilder = new StringBuilder();
    boolean inQuote = false;
    for (char jsonChar : json.toCharArray()) {
      switch (jsonChar) {
        case '"':
          inQuote = !inQuote;
          minimalPrintBuilder.append(jsonChar);
          break;
        default:
          if (inQuote || !Character.toString(jsonChar).matches("\\s")) {
            minimalPrintBuilder.append(jsonChar);
          }
      }
    }
    return minimalPrintBuilder.toString();
  }
public static String minimalPrint ( String json ) { if ( json == null ) new NullPointerException ( ) ; StringBuilder minimalPrintBuilder = new StringBuilder ( ) ; boolean inQuote = false ; for ( char jsonChar : json . toCharArray ( ) ) { switch ( jsonChar ) { case '"' : inQuote = ! inQuote ; minimalPrintBuilder . append ( jsonChar ) ; break ; default : if ( inQuote || ! Character . toString ( jsonChar ) . matches ( "\\s" ) ) { minimalPrintBuilder . append ( jsonChar ) ; } } } return minimalPrintBuilder . toString ( ) ; }
Returns a minimal print JSON of any JSON input.
Returns a minimal print JSON of any JSON input .