Top Description Interfaces Classes Enums
module com.google.gson

Package com.google.gson

Annotations
@CheckReturnValue

This package provides the com.google.gson.Gson class to convert Json to Java and vice-versa.

The primary class to use is com.google.gson.Gson which can be constructed with new Gson() (using default settings) or by using com.google.gson.GsonBuilder (to configure various options such as using versioning and so on).

Author
Inderjeet Singh, Joel Leitch

Interface Summary

Modifier and TypeInterface and Description
public interface
ExclusionStrategy

A strategy (or policy) definition that is used to decide whether or not a field or class should be serialized or deserialized as part of the JSON output/input.

public interface
FieldNamingStrategy

A mechanism for providing custom field naming in Gson.

public interface
InstanceCreator<
the type of object that will be created by this implementation.
T
>

This interface is implemented to create instances of a class that does not define a no-args constructor.

public interface
JsonDeserializationContext

Context for deserialization that is passed to a custom deserializer during invocation of its JsonDeserializer#deserialize(JsonElement, Type, JsonDeserializationContext) method.

public interface
JsonDeserializer<
type for which the deserializer is being registered. It is possible that a deserializer may be asked to deserialize a specific generic type of the T.
T
>

Interface representing a custom deserializer for JSON.

public interface
JsonSerializationContext

Context for serialization that is passed to a custom serializer during invocation of its JsonSerializer#serialize(Object, Type, JsonSerializationContext) method.

public interface
JsonSerializer<
type for which the serializer is being registered. It is possible that a serializer may be asked to serialize a specific generic type of the T.
T
>

Interface representing a custom serializer for JSON.

public interface
ReflectionAccessFilter

Filter for determining whether reflection based serialization and deserialization is allowed for a class.

public interface
ToNumberStrategy

A strategy that is used to control how numbers should be deserialized for Object and Number when a concrete type of the deserialized number is unknown in advance.

public interface
TypeAdapterFactory

Creates type adapters for set of related types.

Class Summary

Modifier and TypeClass and Description
public class
FieldAttributes

A data object that stores attributes of a field.

public class
FormattingStyle

A class used to control what the serialization output looks like.

public class
Gson

This is the main class for using Gson.

public class
GsonBuilder

Use this builder to construct a Gson instance when you need to set configuration options other than the default.

public class
JsonArray

A class representing an array type in JSON.

public abstract class
JsonElement

A class representing an element of JSON.

public class
JsonIOException

This exception is raised when Gson was unable to read an input stream or write to one.

public class
JsonNull

A class representing a JSON null value.

public class
JsonObject

A class representing an object type in JSON.

public class
JsonParseException

This exception is raised if there is a serious issue that occurs during parsing of a Json string.

public class
JsonParser

A parser to parse JSON into a parse tree of JsonElements.

public class
JsonPrimitive

A class representing a JSON primitive value.

public class
JsonStreamParser

A streaming parser that allows reading of multiple JsonElements from the specified reader asynchronously.

public class
JsonSyntaxException

This exception is raised when Gson attempts to read (or write) a malformed JSON element.

public abstract class
TypeAdapter<T>

Converts Java objects to and from JSON.

Enum Summary

Modifier and TypeEnum and Description
public enum
FieldNamingPolicy

An enumeration that defines a few standard naming conventions for JSON field names.

public enum
LongSerializationPolicy

Defines the expected format for a long or Long type when it is serialized.

public enum
Strictness

Modes that indicate how strictly a JSON reader or writer follows the syntax laid out in the RFC 8259 JSON specification.

public enum
ToNumberPolicy

An enumeration that defines two standard number reading strategies and a couple of strategies to overcome some historical Gson limitations while deserializing numbers as Object and Number.