JSON 语义,Java 对象
将 JSONPath、JSON Pointer、JSON Patch 和 JSON Schema 直接用于 POJO、Map、List 和领域模型,无需构造中间 JSON 树。
将 JSONPath、JSON Pointer、JSON Patch 和 JSON Schema 直接用于 POJO、Map、List 和领域模型,无需构造中间 JSON 树。
通过统一 API 使用多种 JSON 后端:Jackson 2.x/3.x、Gson、Fastjson2、JSON-P,以及 SnakeYAML 等 YAML 和其他格式实现。
通过灵活的 Runtime API 和高性能的 Compiled API,直接操作 Java 对象。
通过统一 API 处理 JSON、YAML 和 Java Properties,支持 POJO、Map、List、泛型及自定义值类型。
public class User {
public String name;
public int age;
public Address address;
}
public class Address {
public String city;
}
Sjf4j sjf4j = Sjf4j.builder().build();
User user = sjf4j.fromJson(json, User.class);
String json2 = sjf4j.toJsonString(user);@CompiledBinder
interface UserBinder {
@Read User fromJson(String json);
@Write String toJson(User user);
}
UserBinder binder = CompiledInstances.create(UserBinder.class);
User user = binder.fromJson(json);
String json2 = binder.toJson(user);SJF4J 通过开放的流式架构支持自定义格式和后端,同时提供 @OneOf 多态绑定、ValueCodec 自定义值转换和 ExternalNode 集成。
以上为特定测试场景下的性能比值,并非跨类别排名。各项测试的对比基准不同,详情请参阅图表与原始报告。
将 SJF4J Compiled API 直接注入 Spring Bean,无需手动创建实例或添加组件注解。
@CompiledMapper
public interface UserMapper {
UserDto toDto(User user);
}@Service
public class UserService {
@Autowired
private UserMapper mapper;
public UserDto convert(User user) {
return mapper.toDto(user);
}
}自动注册 Bean 编译期生成实现类 标准 Spring 依赖注入