Class responsible for the actual String serialization of the possible values of a JSON structure.
This class can also be used as a category, so as to add toJson()
methods to various types.
Modifiers | Name | Description |
---|---|---|
static class |
JsonOutput.JsonUnescaped |
Represents unescaped JSON |
static class |
JsonOutput.JsonWritable |
Represents unescaped JSON |
Modifiers | Name | Description |
---|---|---|
static char |
CLOSE_BRACE |
|
static char |
CLOSE_BRACKET |
|
static char |
COLON |
|
static char |
COMMA |
|
static char |
NEW_LINE |
|
static java.lang.String |
NULL_VALUE |
|
static char |
OPEN_BRACE |
|
static char |
OPEN_BRACKET |
|
static char |
QUOTE |
|
static char |
SPACE |
Type | Name and description |
---|---|
static java.lang.String |
prettyPrint(java.lang.String jsonPayload) Pretty print a JSON payload. |
static java.lang.String |
toJson(java.lang.Boolean bool) @return "true" or "false" for a boolean value |
static java.lang.String |
toJson(java.lang.Number n) @return a string representation for a number |
static java.lang.String |
toJson(java.lang.Character c) @return a JSON string representation of the character |
static java.lang.String |
toJson(java.lang.String s) @return a properly encoded string with escape sequences |
static java.lang.String |
toJson(java.util.Date date) Format a date that is parseable from JavaScript, according to ISO-8601. |
static java.lang.String |
toJson(java.util.Calendar cal) Format a calendar instance that is parseable from JavaScript, according to ISO-8601. |
static java.lang.String |
toJson(java.util.UUID uuid) @return the string representation of an uuid |
static java.lang.String |
toJson(java.net.URL url) @return the string representation of the URL |
static java.lang.String |
toJson(groovy.lang.Closure closure) @return an object representation of a closure |
static java.lang.String |
toJson(groovy.util.Expando expando) @return an object representation of an Expando |
static java.lang.String |
toJson(java.lang.Object object) @return "null" for a null value, or a JSON array representation for a collection, array, iterator or enumeration, or representation for other object. |
static java.lang.String |
toJson(java.util.Map m) @return a JSON object representation for a map |
static JsonOutput.JsonUnescaped |
unescaped(java.lang.CharSequence text) Obtains JSON unescaped text for the given text |
Methods inherited from class | Name |
---|---|
class java.lang.Object |
java.lang.Object#wait(long, int), java.lang.Object#wait(long), java.lang.Object#wait(), java.lang.Object#equals(java.lang.Object), java.lang.Object#toString(), java.lang.Object#hashCode(), java.lang.Object#getClass(), java.lang.Object#notify(), java.lang.Object#notifyAll() |
Pretty print a JSON payload.
Format a date that is parseable from JavaScript, according to ISO-8601.
date
- the date to format to a JSON stringFormat a calendar instance that is parseable from JavaScript, according to ISO-8601.
cal
- the calendar to format to a JSON string
Obtains JSON unescaped text for the given text
text
- The text