Package org.grails.web.json
Class PrettyPrintJSONWriter
- java.lang.Object
-
- org.grails.web.json.JSONWriter
-
- org.grails.web.json.PrettyPrintJSONWriter
-
public class PrettyPrintJSONWriter extends JSONWriter
A JSONWriter dedicated to create indented/pretty printed output.- Since:
- 1.1
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.grails.web.json.JSONWriter
JSONWriter.Mode
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEFAULT_INDENT_STRstatic java.lang.StringNEWLINE-
Fields inherited from class org.grails.web.json.JSONWriter
comma, mode, writer
-
-
Constructor Summary
Constructors Constructor Description PrettyPrintJSONWriter(java.io.Writer w)PrettyPrintJSONWriter(java.io.Writer w, java.lang.String indentStr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected JSONWriterappend(groovy.lang.Writable writableValue)JSONWriterarray()Begin appending a new array.protected JSONWriterend(JSONWriter.Mode m, char c)End something.JSONWriterendArray()End an array.JSONWriterendObject()End an object.JSONWriterkey(java.lang.String s)Append a key.JSONWriterobject()Begin appending a new object.
-
-
-
Field Detail
-
DEFAULT_INDENT_STR
public static final java.lang.String DEFAULT_INDENT_STR
- See Also:
- Constant Field Values
-
NEWLINE
public static final java.lang.String NEWLINE
-
-
Method Detail
-
append
protected JSONWriter append(groovy.lang.Writable writableValue)
- Overrides:
appendin classJSONWriter
-
end
protected JSONWriter end(JSONWriter.Mode m, char c)
Description copied from class:JSONWriterEnd something.- Overrides:
endin classJSONWriter- Parameters:
m- Modec- Closing character- Returns:
- this
-
array
public JSONWriter array()
Description copied from class:JSONWriterBegin appending a new array. All values until the balancingendArraywill be appended to this array. TheendArraymethod must be called to mark the array's end.- Overrides:
arrayin classJSONWriter- Returns:
- this
-
endArray
public JSONWriter endArray()
Description copied from class:JSONWriterEnd an array. This method most be called to balance calls toarray.- Overrides:
endArrayin classJSONWriter- Returns:
- this
-
object
public JSONWriter object()
Description copied from class:JSONWriterBegin appending a new object. All keys and values until the balancingendObjectwill be appended to this object. TheendObjectmethod must be called to mark the object's end.- Overrides:
objectin classJSONWriter- Returns:
- this
-
endObject
public JSONWriter endObject()
Description copied from class:JSONWriterEnd an object. This method most be called to balance calls toobject.- Overrides:
endObjectin classJSONWriter- Returns:
- this
-
key
public JSONWriter key(java.lang.String s)
Description copied from class:JSONWriterAppend a key. The key will be associated with the next value. In an object, every value must be preceded by a key.- Overrides:
keyin classJSONWriter- Parameters:
s- A key string.- Returns:
- this
-
-