Package cloud.opencode.base.json


package cloud.opencode.base.json
OpenCode JSON - Unified JSON Processing Facade OpenCode JSON - 统一 JSON 处理门面

This package provides a unified facade API for JSON serialization/deserialization with SPI mechanism supporting multiple JSON engines (Jackson, Gson, Fastjson2).

本包提供统一的 JSON 序列化/反序列化门面 API,通过 SPI 机制支持多种 JSON 引擎 (Jackson、Gson、Fastjson2)。

Key Classes | 核心类:

  • OpenJson - Static facade entry point - 静态门面入口
  • TypeReference - Generic type reference - 泛型类型引用
  • JsonConfig - JSON configuration - JSON 配置
  • JsonNode - Generic JSON node - 通用 JSON 节点

Sub-packages | 子包:

  • spi - SPI provider interfaces - SPI 提供者接口
  • path - JSONPath and JsonPointer - JSONPath 和 JsonPointer
  • stream - Streaming API - 流式 API
  • annotation - JSON annotations - JSON 注解
  • exception - JSON exceptions - JSON 异常
  • patch - JSON Patch/Merge Patch - JSON 补丁
  • schema - JSON Schema validation - JSON Schema 验证
  • diff - JSON diff comparison - JSON 差异比较
  • security - Security features - 安全特性
  • adapter - Type adapters - 类型适配器

Usage Examples | 使用示例:

// Serialize
String json = OpenJson.toJson(user);

// Deserialize
User user = OpenJson.fromJson(json, User.class);

// Generic type
List<User> users = OpenJson.fromJson(json, new TypeReference<List<User>>() {});

// JSONPath
String name = OpenJson.read(json, "$.user.name");
Since:
JDK 25, opencode-base-json V1.0.0
Author:
Leon Soo www.LeonSoo.com
See Also: