# alibaba/fastjson2

**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/alibaba-fastjson2).**

4,307 stars · 572 forks · Java · Apache-2.0

## Links

- GitHub: https://github.com/alibaba/fastjson2
- awesome-repositories: https://awesome-repositories.com/repository/alibaba-fastjson2.md

## Topics

`android` `big-data` `deserialization` `fastjson` `fastjson2` `graal` `graalvm-native-image` `high-performance` `java` `java-json` `json` `json-deserialization` `json-parser` `json-path` `json-serialization` `json-serializer` `jsonb` `serialization`

## Description

fastjson2 is a high-performance Java library used for serializing and deserializing Java objects to and from JSON strings and byte arrays. It functions as a binary JSON serializer for encoding objects into optimized binary formats to reduce payload size and increase processing speed.

The project includes a JSONPath query engine for extracting specific data and fields from JSON documents using standardized path expressions and filters. It also serves as a JSON schema validator, providing utilities to generate data contracts and validate JSON input against defined schemas to ensure structural correctness.

The library covers a broad range of data handling capabilities, including the transformation of JSON into maps or specific object types and the conversion of Java beans into binary formats. It provides mechanisms for custom serialization logic, field mapping via annotations, and the ability to preserve object types during conversion.

## Tags

### Data & Databases

- [JSON-to-Object Mappers](https://awesome-repositories.com/f/data-databases/custom-type-converters/json-converters/graph-to-json-converters/json-to-object-mappers.md) — Transforms JSON strings and byte arrays into specific Java object types using class references. ([source](https://cdn.jsdelivr.net/gh/alibaba/fastjson2@main/README.md))
- [JSON Deserializers](https://awesome-repositories.com/f/data-databases/json-deserializers.md) — Transforms JSON strings and byte arrays into Java objects or maps for application processing.
- [Binary Deserialization](https://awesome-repositories.com/f/data-databases/binary-data-accessors/binary-deserialization.md) — Reconstructs Java objects from binary data using embedded type information for automatic resolution. ([source](https://github.com/alibaba/fastjson2/wiki/fastjson_benchmark))
- [Binary JSON Serialization](https://awesome-repositories.com/f/data-databases/binary-json-serialization.md) — Converts objects into an optimized binary JSON format (JSONB) to reduce payload size and increase speed. ([source](https://alibaba.github.io/fastjson2/JSONB/jsonb_format_en))
- [Binary Serialization Formats](https://awesome-repositories.com/f/data-databases/binary-serialization-formats.md) — Encodes Java objects into optimized binary formats to reduce payload size and increase processing speed.
- [JSONPath Extraction](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/data-extraction-ingestion/data-extraction/jsonpath-extraction.md) — Implements a JSONPath query engine to extract specific values from documents without full deserialization.
- [High-Performance JSON Encoders](https://awesome-repositories.com/f/data-databases/json-parsers/high-performance-json-encoders.md) — Implements highly optimized encoding processes to convert data structures into JSON with minimal overhead.
- [Class Instance Binary Serializers](https://awesome-repositories.com/f/data-databases/object-storage-services/binary-object-chunkers/binary-object-storage/class-instance-binary-serializers.md) — Transforms Java objects into UTF-8 byte arrays for efficient caching and RPC communication. ([source](https://github.com/alibaba/fastjson2/wiki/fastjson_benchmark))
- [JSON Serializers](https://awesome-repositories.com/f/data-databases/text-to-json-converters/json-serializers.md) — Converts Java objects into JSON strings or byte arrays for storage and network transmission. ([source](https://cdn.jsdelivr.net/gh/alibaba/fastjson2@main/README.md))
- [Class Instance Binary Serializers](https://awesome-repositories.com/f/data-databases/binary-serialization-formats/class-instance-binary-serializers.md) — Converts typed class instances to compact binary representations while preserving class information for automatic type resolution. ([source](https://github.com/alibaba/fastjson2/wiki/fastjson_benchmark))
- [Generic Map Deserialization](https://awesome-repositories.com/f/data-databases/custom-type-converters/json-converters/graph-to-json-converters/json-to-object-mappers/generic-map-deserialization.md) — Transforms JSON strings into generic map structures for flexible and dynamic data access. ([source](https://github.com/alibaba/fastjson2/wiki/fastjson_benchmark))
- [Direct Memory Buffers](https://awesome-repositories.com/f/data-databases/data-buffering/binary-data-buffers/direct-memory-buffers.md) — Utilizes direct memory buffers to write UTF-8 bytes, minimizing object allocation and garbage collection pressure.
- [Object Hierarchy Querying](https://awesome-repositories.com/f/data-databases/data-engineering-infrastructure/data-extraction-ingestion/data-extraction/object-hierarchy-querying.md) — Evaluates JSONPath expressions against Java object hierarchies to retrieve specific data. ([source](https://alibaba.github.io/fastjson2/JSONPath/jsonpath_en))
- [Data Type Serialization Configurations](https://awesome-repositories.com/f/data-databases/data-processing-pipelines/data-serialization/serialization-configuration-managers/data-type-serialization-configurations.md) — Allows configuration of serialization behavior, including null handling, formatting, and matching logic. ([source](https://cdn.jsdelivr.net/gh/alibaba/fastjson2@main/README.md))
- [Custom Serialization Interfaces](https://awesome-repositories.com/f/data-databases/data-type-managers/dynamic-type-managers/custom-type-serializers/custom-serialization-interfaces.md) — Provides dedicated reader and writer interfaces for implementing custom serialization logic for complex data types.
- [Custom Serializer Implementations](https://awesome-repositories.com/f/data-databases/data-type-managers/dynamic-type-managers/custom-type-serializers/custom-serialization-interfaces/custom-serializer-implementations.md) — Enables the creation of custom serializers by implementing dedicated reading and writing logic. ([source](https://cdn.jsdelivr.net/gh/alibaba/fastjson2@main/README.md))
- [Custom Field Mapping](https://awesome-repositories.com/f/data-databases/json-data-parsers/custom-field-mapping.md) — Supports customizing field names, date formats, and visibility rules through class annotations. ([source](https://cdn.jsdelivr.net/gh/alibaba/fastjson2@main/README.md))
- [Schema Validators](https://awesome-repositories.com/f/data-databases/json-schema-modeling/schema-validators.md) — Provides a JSON schema validator to ensure incoming data conforms to a predefined structural template.
- [Token-Based Streaming Parsers](https://awesome-repositories.com/f/data-databases/token-based-streaming-parsers.md) — Implements token-based stream parsing to process JSON documents incrementally and reduce memory usage.

### Programming Languages & Runtimes

- [JSON Libraries](https://awesome-repositories.com/f/programming-languages-runtimes/json-libraries.md) — Provides a high-performance suite of parsing, generation, and object mapping capabilities for JSON in Java.
- [JsonPath Implementations](https://awesome-repositories.com/f/programming-languages-runtimes/jsonpath-implementations.md) — Implements the JSONPath expression language to extract specific data and fields from JSON documents.
- [Bytecode Generation](https://awesome-repositories.com/f/programming-languages-runtimes/reflection-based-object-manipulation/object-mapping/bytecode-generation.md) — Implements high-performance object mapping by generating specialized Java bytecode at runtime to bypass reflection.
- [Type-to-Schema Generation](https://awesome-repositories.com/f/programming-languages-runtimes/json-schema-converters/json-schema-generators/type-to-schema-generation.md) — Generates standard JSON schema formats directly from Java type definitions to share data contracts. ([source](https://alibaba.github.io/fastjson2/JSONSchema/json_schema_en))
- [Type Preservation](https://awesome-repositories.com/f/programming-languages-runtimes/type-preservation.md) — Maintains full type information during conversion to ensure complex objects are restored exactly as stored. ([source](https://alibaba.github.io/fastjson2/JSONB/jsonb_format_en))

### Software Engineering & Architecture

- [Compact Binary Object Encoding](https://awesome-repositories.com/f/software-engineering-architecture/compact-binary-object-encoding.md) — Provides optimized conversion of Java objects into minimized binary formats to reduce payload size. ([source](https://cdn.jsdelivr.net/gh/alibaba/fastjson2@main/README.md))
- [Data Validation Schemas](https://awesome-repositories.com/f/software-engineering-architecture/data-validation-schemas.md) — Checks input JSON data against defined schemas to ensure structural correctness and type safety. ([source](https://alibaba.github.io/fastjson2/JSONSchema/json_schema_en))
- [JSON Schema Validation](https://awesome-repositories.com/f/software-engineering-architecture/json-schema-validation.md) — Validates the integrity and presence of required fields in JSON data against a defined schema.
