Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## grails.util
Class JSonBuilder

    java.lang.Object
      groovy.lang.GroovyObjectSupport
          groovy.util.BuilderSupport
              grails.util.JSonBuilder

All Implemented Interfaces:
  groovy.lang.GroovyObject

Deprecated. Use `JSONBuilder` instead Date Created: May, 18, 2006

    public class JSonBuilder

extends groovy.util.BuilderSupport

JSonBuilder provides support for creating JSON responses

If this builder is used in controllers no views should be configured since content will be written to the HttpServletResponse instance. Also no operations should be performed on the response object prior to passing it to this builder.

This builder will set the content type of the response to "application/json"

Sending a simple key value pair to the client requires this code:

     new JsonBuilder(response).json{ message('Hello World') }

will produce output as follows:

    {"message":"Hello World"}

Since:
  0.2
Author:
  Michał Kłujszo, Graeme Rocher

Constructor Summary
`JSonBuilder(HttpServletResponse response)` Deprecated.
`JSonBuilder(JSONWriter _writer)` Deprecated.
`JSonBuilder(Writer writer)` Deprecated.

Method Summary
`protected Object` | `createNode(Object name)` Deprecated.
`protected Object` | `createNode(Object key, Map valueMap)` Deprecated.
`protected Object` | `createNode(Object arg0, Map arg1, Object arg2)` Deprecated.
`protected Object` | `createNode(Object key, Object value)` Deprecated.
`protected void` | `nodeCompleted(Object parent, Object node)` Deprecated.
`protected void` | `setParent(Object arg0, Object arg1)` Deprecated.

Methods inherited from class groovy.util.BuilderSupport
`doInvokeMethod, getCurrent, getName, invokeMethod, invokeMethod, postNodeCompletion, setClosureDelegate, setCurrent`

Methods inherited from class groovy.lang.GroovyObjectSupport
`getMetaClass, getProperty, setMetaClass, setProperty`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JSonBuilder

    public JSonBuilder(HttpServletResponse response)
                throws IOException

  Deprecated.
  Throws:
    `IOException`

### JSonBuilder

    public JSonBuilder(JSONWriter _writer)

  Deprecated.

### JSonBuilder

    public JSonBuilder(Writer writer)

  Deprecated.

Method Detail

### createNode

    protected Object createNode(Object name)

  Deprecated.
  Specified by:
    `createNode` in class `groovy.util.BuilderSupport`

### createNode

    protected Object createNode(Object key,
                                Map valueMap)

  Deprecated.
  Specified by:
    `createNode` in class `groovy.util.BuilderSupport`

### createNode

    protected Object createNode(Object arg0,
                                Map arg1,
                                Object arg2)

  Deprecated.
  Specified by:
    `createNode` in class `groovy.util.BuilderSupport`

### createNode

    protected Object createNode(Object key,
                                Object value)

  Deprecated.
  Specified by:
    `createNode` in class `groovy.util.BuilderSupport`

### nodeCompleted

    protected void nodeCompleted(Object parent,
                                 Object node)

  Deprecated.
  Overrides:
    `nodeCompleted` in class `groovy.util.BuilderSupport`

### setParent

    protected void setParent(Object arg0,
                             Object arg1)

  Deprecated.
  Specified by:
    `setParent` in class `groovy.util.BuilderSupport`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2005-2009 The Grails project