当前位置: 首页 > 工具软件 > Genson > 使用案例 >

Genson 0.95 发布,Java 的 JSON 映射库

孔乐邦
2023-12-01

Genson 0.95 增加对 JAXB 支持和上下文转换。

Genson 是一个轻量级的 Java 库用来处理 JSON 数据,提供了完全的数据绑定和 Java 泛型支持。

示例代码:

1Genson genson = new Genson();
2String json = genson.serialize(777.777); // the output will be 777.777
3genson.serialize(true); // output is true (without quotes)
4 
5genson.deserialize("777", int.class); // deserializes it into 777
6genson.deserialize("777.777", Object.class); // will return 777.777 (a double)
7genson.deserialize("null", Object.class); // will return null;

转载于:https://www.cnblogs.com/shihao/archive/2013/05/23/3095769.html

 类似资料: