public class JsonOutput extends Object
toJson()
methods to various types.Modifier and Type | Class and Description |
---|---|
static class |
JsonOutput.JsonUnescaped
Represents unescaped JSON
|
Constructor and Description |
---|
JsonOutput() |
Modifier and Type | Method and Description |
---|---|
static String |
prettyPrint(String jsonPayload)
Pretty print a JSON payload.
|
static String |
toJson(Boolean bool) |
static String |
toJson(Calendar cal)
Format a calendar instance that is parseable from JavaScript, according to ISO-8601.
|
static String |
toJson(Character c) |
static String |
toJson(Closure closure) |
static String |
toJson(Date date)
Format a date that is parseable from JavaScript, according to ISO-8601.
|
static String |
toJson(Expando expando) |
static String |
toJson(Map m) |
static String |
toJson(Number n) |
static String |
toJson(Object object) |
static String |
toJson(String s) |
static String |
toJson(URL url) |
static String |
toJson(UUID uuid) |
static JsonOutput.JsonUnescaped |
unescaped(CharSequence text)
Obtains JSON unescaped text for the given text
|
public static String toJson(Number n)
JsonException
- if the number is infinite or not a number.public static String toJson(Character c)
public static String toJson(String s)
public static String toJson(Date date)
date
- the date to format to a JSON stringpublic static String toJson(Calendar cal)
cal
- the calendar to format to a JSON stringpublic static String toJson(Object object)
public static String prettyPrint(String jsonPayload)
jsonPayload
- public static JsonOutput.JsonUnescaped unescaped(CharSequence text)
text
- The text