Java JSON library supporting text JSON and binary JSONB, JSONPath extraction, Kotlin extensions, and Spring integration modules.
Overview
FASTJSON2 is a Java JSON library positioned as the successor to FASTJSON, focused on parsing, generating, and partially reading JSON documents with optional binary JSONB encoding. It provides JSONObject and JSONArray helpers, JavaBean mapping, annotations such as JSONField, custom serializers, filters, and JSON Schema validation support.
JSONPath implements SQL:2016-style path syntax for extracting fields without full-document binding, including use on JSONB byte arrays. Reader and writer feature flags default off for fine-grained control over behavior such as smart matching and reference handling. AutoType is disabled by default with SafeMode-oriented security guidance compared to the 1.x line.
Optional modules cover fastjson 1.x compatibility, Kotlin DSL-style extensions, Spring Framework 5 and 6 integration, Android 8+ clients, and GraalVM native image compatibility. Guides cover migration from 1.x, Spring wiring, and benchmark-oriented performance notes.
Artifacts publish under Maven coordinates com.alibaba.fastjson2 with a distinct groupId from the 1.x releases. Usage centers on importing com.alibaba.fastjson2 packages in application code rather than running a standalone service.
Key features
- JSON and JSONB parse and serialize
- JSONPath partial document extraction
- JSONObject JSONArray and JavaBean mapping
- Custom ObjectReader and ObjectWriter hooks
- Annotation-driven field configuration
- Kotlin extension module
- Spring Framework integration modules
- AutoType disabled by default
Use cases
- High-throughput JSON in Java services
- Binary JSONB payloads on the wire
- Selective field reads with JSONPath
- Android client JSON handling