public class JsonOutput
extends java.lang.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 java.lang.String |
prettyPrint(java.lang.String jsonPayload)
Pretty print a JSON payload.
|
static java.lang.String |
toJson(java.lang.Boolean bool) |
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.lang.Character c) |
static java.lang.String |
toJson(Closure closure) |
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(Expando expando) |
static java.lang.String |
toJson(java.util.Map m) |
static java.lang.String |
toJson(java.lang.Number n) |
static java.lang.String |
toJson(java.lang.Object object) |
static java.lang.String |
toJson(java.lang.String s) |
static java.lang.String |
toJson(java.net.URL url) |
static java.lang.String |
toJson(java.util.UUID uuid) |
static JsonOutput.JsonUnescaped |
unescaped(java.lang.CharSequence text)
Obtains JSON unescaped text for the given text
|
public static java.lang.String toJson(java.lang.Boolean bool)
public static java.lang.String toJson(java.lang.Number n)
JsonException
- if the number is infinite or not a number.public static java.lang.String toJson(java.lang.Character c)
public static java.lang.String toJson(java.lang.String s)
public static java.lang.String toJson(java.util.Date date)
date
- the date to format to a JSON stringpublic static java.lang.String toJson(java.util.Calendar cal)
cal
- the calendar to format to a JSON stringpublic static java.lang.String toJson(java.util.UUID uuid)
public static java.lang.String toJson(java.net.URL url)
public static java.lang.String toJson(Closure closure)
public static java.lang.String toJson(Expando expando)
public static java.lang.String toJson(java.lang.Object object)
public static java.lang.String toJson(java.util.Map m)
public static java.lang.String prettyPrint(java.lang.String jsonPayload)
jsonPayload
- public static JsonOutput.JsonUnescaped unescaped(java.lang.CharSequence text)
text
- The text