Package: groovy.json

## [Java] Class JsonDelegate

- groovy.json.JsonDelegate

-     public class JsonDelegate
      extends GroovyObjectSupport

  Utility class used as delegate of closures representing JSON objects.

  Since:
    1.8.0

- - ### Methods Summary

    Methods
    Type Params | Return Type | Name and description
    --- | --- | ---
    `` | `public static Map<String, Object>` | `cloneDelegateAndGetContent(Closure<?> c)` Factory method for creating `JsonDelegate`s from closures.
    `` | `public static Map<String, Object>` | `curryDelegateAndGetContent(Closure<?> c, Object o)` Factory method for creating `JsonDelegate`s from closures currying an object argument.
    `` | `public Map<String, Object>` | `getContent()` Returns the JSON object content accumulated by this delegate.
    `` | `public Object` | `invokeMethod(String name, Object args)` Intercepts calls for setting a key and value for a JSON object

  - ### Inherited Methods Summary

    Inherited Methods
    Methods inherited from class | Name
    --- | ---
    `class GroovyObjectSupport` | `getMetaClass, setMetaClass`

- - ### Method Detail

    - #### public static Map<String, Object> cloneDelegateAndGetContent(Closure<?> c)

      Factory method for creating `JsonDelegate`s from closures.

      Parameters:
        `c` - closure representing JSON objects
      Returns:
        an instance of `JsonDelegate`

    - #### public static Map<String, Object> curryDelegateAndGetContent(Closure<?> c, Object o)

      Factory method for creating `JsonDelegate`s from closures currying an object argument.

      Parameters:
        `c` - closure representing JSON objects
        `o` - an object curried to the closure
      Returns:
        an instance of `JsonDelegate`

    - #### public Map<String, Object> getContent()

      Returns the JSON object content accumulated by this delegate.

      Returns:
        the collected key/value pairs

    - #### public Object invokeMethod(String name, Object args)

      Intercepts calls for setting a key and value for a JSON object

      Parameters:
        `name` - the key name
        `args` - the value associated with the key