public class JSON extends AbstractConverter
A converter that converts domain classes, Maps, Lists, Arrays, POJOs and POGOs to JSON.
| Modifiers | Name | Description | 
|---|---|---|
| class | JSON.Builder | 
| Modifiers | Name | Description | 
|---|---|---|
| protected CircularReferenceBehaviour | circularReferenceBehaviour | |
| protected ConverterConfiguration<JSON> | config | |
| protected boolean | prettyPrint | |
| protected java.util.Stack<java.lang.Object> | referenceStack | |
| protected java.lang.Object | target | |
| protected JSONWriter | writer | 
| Fields inherited from class | Fields | 
|---|---|
| class AbstractConverter | contentType, encoding, excludes, includes | 
| Type | Name and description | 
|---|---|
| void | build(groovy.lang.Closure c) | 
| void | convertAnother(java.lang.Object o) | 
| static void | createNamedConfig(java.lang.String name, groovy.lang.Closure<?> callable) | 
| int | getDepth() | 
| static ConverterConfiguration<JSON> | getNamedConfig(java.lang.String configName) | 
| JSONWriter | getWriter() | 
| protected void | handleCircularRelationship(java.lang.Object o) | 
| protected ConverterConfiguration<JSON> | initConfig() | 
| ObjectMarshaller<JSON> | lookupObjectMarshaller(java.lang.Object target) | 
| static JSONElement | parse(java.io.Reader reader)Parses the given JSON String and returns either a JSONObject or a JSONArray | 
| static JSONElement | parse(java.lang.String source)Parses the given JSON String and returns either a JSONObject or a JSONArray | 
| static JSONElement | parse(java.io.InputStream is, java.lang.String encoding)Parses the given JSON and returns either a JSONObject or a JSONArray | 
| static java.lang.Object | parse(javax.servlet.http.HttpServletRequest request)Parses the given request's InputStream and returns either a JSONObject or a JSONArray | 
| void | property(java.lang.String key, java.lang.Object value) | 
| static void | registerObjectMarshaller(java.lang.Class<?> clazz, groovy.lang.Closure<?> callable) | 
| static void | registerObjectMarshaller(java.lang.Class<?> clazz, int priority, groovy.lang.Closure<?> callable) | 
| static void | registerObjectMarshaller(ObjectMarshaller<JSON> om) | 
| static void | registerObjectMarshaller(ObjectMarshaller<JSON> om, int priority) | 
| void | render(java.io.Writer out)Directs the JSON Writer to the given Writer | 
| void | render(javax.servlet.http.HttpServletResponse response)Directs the JSON Writer to the Outputstream of the HttpServletResponse and sets the Content-Type to application/json | 
| void | setExcludes(java.util.List<java.lang.String> excludes) | 
| void | setIncludes(java.util.List<java.lang.String> includes) | 
| void | setPrettyPrint(boolean prettyPrint) | 
| void | setTarget(java.lang.Object target)Sets the Object which is later converted to JSON | 
| java.lang.String | toString(boolean prettyPrint)Performs the conversion and returns the resulting JSON as String | 
| static java.lang.Object | use(java.lang.String configName, groovy.lang.Closure<?> callable) | 
| static void | use(java.lang.String cfgName) | 
| void | value(java.lang.Object o)@param o | 
| static void | withDefaultConfiguration(groovy.lang.Closure<?> callable) | 
| Methods inherited from class | Name | 
|---|---|
| class AbstractConverter | createBeanWrapper, getExcludes, getIncludes, setContentType, setEncoding, setExcludes, setIncludes, setTarget, toString | 
| 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() | 
Default Constructor for a JSON Converter
Creates a new JSON Converter for the given Object
target -  the Object to convertParses the given JSON String and returns either a JSONObject or a JSONArray
reader -  JSON sourceParses the given JSON String and returns either a JSONObject or a JSONArray
source -  A string containing some JSONParses the given JSON and returns either a JSONObject or a JSONArray
is -        An InputStream which delivers some JSONencoding -  the Character Encoding to useParses the given request's InputStream and returns either a JSONObject or a JSONArray
request -  the JSON RequestDirects the JSON Writer to the given Writer
out -  the WriterDirects the JSON Writer to the Outputstream of the HttpServletResponse and sets the Content-Type to application/json
response -  a HttpServletResponseSets the Object which is later converted to JSON
target -  the ObjectPerforms the conversion and returns the resulting JSON as String
prettyPrint -  true, if the output should be indented, otherwise false