@Override public String toJson(final Object obj) { return ((JSONCollection) obj).toCompactString(); }
/** * Converts the JSONObject to a compact or pretty-print string representation * * @param compact * if true, return minimal format string. * @since 5.2.0 */ public String toString(boolean compact) { return compact ? toCompactString() : toString(); }
/** * Prints the JSONObject to the writer compactly (with no extra whitespace). */ public void print(PrintWriter writer) { print(writer, true); }
/** * Converts the JSONObject to a compact or pretty-print string representation * * @param compact * if true, return minimal format string. * @since 5.2.0 */ public String toString(boolean compact) { return compact ? toCompactString() : toString(); }
/** * Prints the JSONObject to the writer using indentation (two spaces per indentation level). */ public void prettyPrint(PrintWriter writer) { print(writer, false); }
@Override public String toJson(final Object obj) { return ((JSONCollection) obj).toCompactString(); }
/** * Prints the JSONObject to the writer compactly (with no extra whitespace). */ public void print(PrintWriter writer) { print(writer, true); }
@Override public String toJson(final Object obj) { return ((JSONCollection) obj).toCompactString(); }
/** * Prints the JSONObject to the writer using indentation (two spaces per indentation level). */ public void prettyPrint(PrintWriter writer) { print(writer, false); }
/** * Prints the JSONObject as a compact string (not extra punctuation). This is, essentially, what * Tapestry 5.1 did inside {@link #toString()}. */ public String toCompactString() { CharArrayWriter caw = new CharArrayWriter(); PrintWriter pw = new PrintWriter(caw); print(pw); pw.close(); return caw.toString(); }
/** * Prints the JSONObject as a compact string (not extra punctuation). This is, essentially, what * Tapestry 5.1 did inside {@link #toString()}. */ public String toCompactString() { CharArrayWriter caw = new CharArrayWriter(); PrintWriter pw = new PrintWriter(caw); print(pw); pw.close(); return caw.toString(); }
/** * Converts this JSON collection into a parsable string representation. * * Warning: This method assumes that the data structure is acyclical. * * Starting in release 5.2, the result will be pretty printed for readability. * * @return a printable, displayable, portable, transmittable representation of the object, beginning with * <code>{</code> <small>(left brace)</small> and ending with <code>}</code> <small>(right * brace)</small>. */ @Override public String toString() { CharArrayWriter caw = new CharArrayWriter(); PrintWriter pw = new PrintWriter(caw); JSONPrintSession session = new PrettyPrintSession(pw); print(session); pw.close(); return caw.toString(); }
/** * Converts this JSON collection into a parsable string representation. * * Warning: This method assumes that the data structure is acyclical. * * Starting in release 5.2, the result will be pretty printed for readability. * * @return a printable, displayable, portable, transmittable representation of the object, beginning with * <code>{</code> <small>(left brace)</small> and ending with <code>}</code> <small>(right * brace)</small>. */ @Override public String toString() { CharArrayWriter caw = new CharArrayWriter(); PrintWriter pw = new PrintWriter(caw); JSONPrintSession session = new PrettyPrintSession(pw); print(session); pw.close(); return caw.toString(); }
/** * Prints the JSONObject to the write (compactly or not). * * @param writer * to write content to * @param compact * if true, then write compactly, if false, write with pretty printing * @since 5.2.1 */ public void print(PrintWriter writer, boolean compact) { JSONPrintSession session = compact ? new CompactSession(writer) : new PrettyPrintSession(writer); print(session); }
/** * Prints the JSONObject to the write (compactly or not). * * @param writer * to write content to * @param compact * if true, then write compactly, if false, write with pretty printing * @since 5.2.1 */ public void print(PrintWriter writer, boolean compact) { JSONPrintSession session = compact ? new CompactSession(writer) : new PrettyPrintSession(writer); print(session); }