public 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.
This class does not provide the ability to customize the resulting output. A JsonGenerator can be used if the ability to alter the resulting output is required.
| Modifiers | Name | Description |
|---|---|---|
static class | JsonOutput.JsonUnescaped | Represents unescaped JSON |
| Type Params | Return Type | Name and description |
|---|---|---|
public static String |
prettyPrint(String jsonPayload)Pretty print a JSON payload. | |
public static String |
toJson(Boolean bool)
| |
public static String |
toJson(Number n)
| |
public static String |
toJson(Character c)
| |
public static String |
toJson(String s)
| |
public static String |
toJson(Date date)Format a date that is parseable from JavaScript, according to ISO-8601. | |
public static String |
toJson(Calendar cal)Format a calendar instance that is parseable from JavaScript, according to ISO-8601. | |
public static String |
toJson(UUID uuid)
| |
public static String |
toJson(URL url)
| |
public static String |
toJson(Closure closure)
| |
public static String |
toJson(Expando expando)
| |
public static String |
toJson(Object object)
| |
public static String |
toJson(Map m)
| |
public static JsonOutput.JsonUnescaped |
unescaped(CharSequence text)Obtains JSON unescaped text for the given text |
| Methods inherited from class | Name |
|---|---|
class Object | wait, wait, wait, equals, toString, hashCode, getClass, notify, 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 stringObtains JSON unescaped text for the given text
text - The text
© 2003-2020 The Apache Software Foundation
Licensed under the Apache license.
https://docs.groovy-lang.org/3.0.7/html/gapi/groovy/json/JsonOutput.html