# google/gson

**Attribution required: if you use, quote, or summarise this content, you must credit and link back to [awesome-repositories.com](https://awesome-repositories.com/repository/google-gson).**

24,357 stars · 4,407 forks · Java · apache-2.0

## Links

- GitHub: https://github.com/google/gson
- awesome-repositories: https://awesome-repositories.com/repository/google-gson.md

## Description

Gson is a Java library designed for the serialization and deserialization of objects into structured text formats. It functions as a reflection-based data mapper, inspecting class structures at runtime to automatically convert memory-resident objects into data representations and reconstruct them back into typed language objects.

The library distinguishes itself through a modular type-adapter pattern that allows for custom conversion rules for complex or nested structures. It also provides robust support for production environments by generating build-time metadata and configuration rules, which ensure that serialized classes remain accessible and functional when subjected to aggressive code shrinking, obfuscation, or native image compilation.

Beyond its core mapping capabilities, the library includes a streaming tokenizer to minimize memory overhead when processing large data sets. It also supports annotation-driven schema mapping, enabling developers to define custom naming conventions and field exclusion rules directly within their source code.

## Tags

### Data & Databases

- [JSON Serialization Libraries](https://awesome-repositories.com/f/data-databases/json-serialization-libraries.md) — Transforms objects into structured JSON text and parses strings back into typed object formats. ([source](https://github.com/google/gson/tree/main/.))
- [Serialization Libraries](https://awesome-repositories.com/f/data-databases/serialization-libraries.md) — Converts complex object graphs into structured text formats and reconstructs them back into typed language objects.
- [Data Serialization Frameworks](https://awesome-repositories.com/f/data-databases/data-serialization-frameworks.md) — Converts complex programming objects into structured text formats and reconstructs them into functional objects.
- [Streaming Parsers](https://awesome-repositories.com/f/data-databases/streaming-parsers.md) — Processes input text as a continuous stream of tokens to minimize memory overhead during parsing.

### Software Engineering & Architecture

- [Type-Safe Data Handling](https://awesome-repositories.com/f/software-engineering-architecture/type-safe-data-handling.md) — Ensures data structures remain consistent and predictable when moving between raw text and strongly typed code.
- [Data Mappers](https://awesome-repositories.com/f/software-engineering-architecture/data-mappers.md) — Inspects class structures to automatically map field values between memory-resident objects and external data representations.
- [Serialization Adapters](https://awesome-repositories.com/f/software-engineering-architecture/serialization-adapters.md) — Encapsulates serialization logic for specific data types into modular components for custom conversion.
- [Schema Mapping Tools](https://awesome-repositories.com/f/software-engineering-architecture/schema-mapping-tools.md) — Provides annotation-driven rules to control field naming and exclusion during automated data transformation.

### DevOps & Infrastructure

- [Native Compilation Metadata](https://awesome-repositories.com/f/devops-infrastructure/native-compilation-metadata.md) — Generates configuration files to ensure classes accessed via reflection remain functional in optimized native binaries.
- [Native Image Configurations](https://awesome-repositories.com/f/devops-infrastructure/native-image-configurations.md) — Configures metadata to ensure classes accessed via reflection remain functional within native executable binaries. ([source](https://github.com/google/gson/tree/main/test-graal-native-image))
- [Native Image Compatibility Tools](https://awesome-repositories.com/f/devops-infrastructure/native-image-compatibility-tools.md) — Configures metadata and reflection rules to ensure serialized classes function correctly in standalone binary executables.

### Development Tools & Productivity

- [Metadata Generators](https://awesome-repositories.com/f/development-tools-productivity/metadata-generators.md) — Provides configuration to ensure serialized class structures remain accessible during code shrinking or native compilation.
