Java 的 JSON 操作类库,Genson 0.94 发布

jopen 11年前

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

Genson 0.94 支持友好格式打印,spring mvc 集成和一些新的默认转换器,可序列化包含毫秒的日期时间,增强对流处理的异常和错误。

示例代码:

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