org.springframework.batch.item.json

## Class GsonJsonObjectMarshaller<T>

- java.lang.Object
- - org.springframework.batch.item.json.GsonJsonObjectMarshaller<T>

- Type Parameters:
    `T` - type of objects to marshal
  All Implemented Interfaces:
    JsonObjectMarshaller<T>

      public class GsonJsonObjectMarshaller<T>
      extends java.lang.Object
      implements JsonObjectMarshaller<T>

  A json object marshaller that uses Google Gson to marshal an object into a json representation.
  Since:
    4.1
  Author:
    Mahmoud Ben Hassine

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `GsonJsonObjectMarshaller()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `marshal(T item)` Marshal an object into a json representation.
    `void` | `setGson(com.google.gson.Gson gson)` Set the `Gson` object to use.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### GsonJsonObjectMarshaller

          public GsonJsonObjectMarshaller()

  - ### Method Detail

    - #### setGson

          public void setGson(com.google.gson.Gson gson)

      Set the `Gson` object to use.
      Parameters:
        `gson` - object to use

    - #### marshal

          public java.lang.String marshal(T item)

      Description copied from interface: `JsonObjectMarshaller`
      Marshal an object into a json representation.
      Specified by:
        `marshal` in interface `JsonObjectMarshaller<T>`
      Parameters:
        `item` - to marshal
      Returns:
        json representation fo the object