|
Groovy Documentation | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object groovy.json.JsonOutput
class JsonOutput
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.
Method Summary | |
---|---|
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(Closure closure)
@return an object representation of a closure |
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. |
static java.lang.String
|
toJson(java.util.Map m)
@return a JSON object representation for a map |
Methods inherited from class java.lang.Object | |
---|---|
java.lang.Object#wait(long), java.lang.Object#wait(long, int), 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() |
Method Detail |
---|
static java.lang.String prettyPrint(java.lang.String jsonPayload)
static java.lang.String toJson(java.lang.Boolean bool)
static java.lang.String toJson(java.lang.Number n)
static java.lang.String toJson(java.lang.Character c)
static java.lang.String toJson(java.lang.String s)
static java.lang.String toJson(java.util.Date date)
date
- the date to format to a JSON string
static java.lang.String toJson(java.util.Calendar cal)
cal
- the calendar to format to a JSON string
static java.lang.String toJson(java.util.UUID uuid)
static java.lang.String toJson(java.net.URL url)
static java.lang.String toJson(Closure closure)
static java.lang.String toJson(java.lang.Object object)
static java.lang.String toJson(java.util.Map m)
Groovy Documentation