code: public static final String format(String json) {
  		final int len = json.length();
  		if (len < 3) {
  			return json;
  		}
  		final StringTokenizer st = new StringTokenizer(json, ",{}[]", true);
  		final StringBuilder out = new StringBuilder(len * 2);
  		String token;
  		int indent = 0;
  		while (st.hasMoreTokens()) {
  			token = st.nextToken();
  			if ("{".equals(token) || "[".equals(token)) {
  				indent++;
  				out.append(token);
  				appendIndent(out, indent);
  				continue;
  			}
  			if ("}".equals(token) || "]".equals(token)) {
  				indent--;
  				appendIndent(out, indent);
  				out.append(token);
  				continue;
  			}
  			if (",".equals(token)) {
  				out.append(',');
  				appendIndent(out, indent);
  				continue;
  			}
  			out.append(token);
  		}
  		return out.toString();
  	}
docs: --- EXTERNAL JSON FORMATTER ---