public abstract class JSONCollection extends Object implements Serializable
JSONArray and JSONObject that exists to organize the code
for printing such objects (either compact or pretty).| Constructor and Description |
|---|
JSONCollection() |
| Modifier and Type | Method and Description |
|---|---|
void |
prettyPrint(PrintWriter writer)
Prints the JSONObject to the writer using indentation (two spaces per indentation level).
|
void |
print(PrintWriter writer)
Prints the JSONObject to the writer compactly (with no extra whitespace).
|
void |
print(PrintWriter writer,
boolean compact)
Prints the JSONObject to the write (compactly or not).
|
String |
toCompactString()
Prints the JSONObject as a compact string (not extra punctuation).
|
String |
toString()
Converts this JSON collection into a parsable string representation.
|
String |
toString(boolean compact)
Converts the JSONObject to a compact or pretty-print string representation
|
public JSONCollection()
public String toString()
public String toString(boolean compact)
compact - if true, return minimal format string.public String toCompactString()
toString().public void print(PrintWriter writer, boolean compact)
writer - to write content tocompact - if true, then write compactly, if false, write with pretty printingpublic void print(PrintWriter writer)
public void prettyPrint(PrintWriter writer)
5.6.4 - Copyright © 2003-2021 The Apache Software Foundation.