Skip to content

Commit 5a8b251

Browse files
authored
Update index.cn.md
1 parent 2a1dc47 commit 5a8b251

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

index.cn.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,11 @@ Jsoniter.deserialize(input).get("items", 0); // the first item
5454
deserialize 的返回值类型是“Any”,它有点类似于 `Map<String, Object>`。两者都是通用的数据容器,但是和  `Map<String, Object>` 不同,Any 有通过  api 使得数据获取上更方便:
5555

5656
```java
57-
Any any = Jsoniter.deserialize(input); // deserialize returns "Any", actual parsing is done lazily
58-
any.get("items", '*', "name", 0); // extract out the first name from all items
59-
any.get("size").toLong(); // no matter it is "100" or 100, return it as long, making Java weakly typed
60-
any.bindTo(Order.class); // binding the JSON into object
61-
for (Any element : any) {} // iterate the collection, Any implements iterable
57+
Any any = Jsoniter.deserialize(input); // deserialize 返回 "Any",实际的解析是延迟在读取时才做的
58+
any.get("items", '*', "name", 0); // 抽取所有 items 的第一个 name
59+
any.get("size").toLong(); // 不管是 "100" 还是 100,都给转成 long 类型,就像弱类型一样
60+
any.bindTo(Order.class); // JSON 绑定到对象
61+
for (Any element : any) {} // 遍历集合,Any 实现了 iterable 接口
6262
```
6363

6464
更好的消息是,这种 schema-less 的体验在延迟解析技术的帮助下,做到了性能上的无损。所有没有别读取的字段,仍然会以 JSON 的原始格式保留。使用 `Any` 的性能要比使用 `Map<String, Object>` 好得多。现在,在 Java 语言中,你也体会到 Javascript 或者 PHP 解析 JSON 时那种丝滑般体验。[JSON 与 any,乐趣多多](http://jsoniter.com/java-features.html#lazy-is-an-option).
@@ -67,7 +67,7 @@ Jsoniter 不仅仅在运行时要做最快的解析器,也同时非常努力
6767

6868
# 文档
6969

70-
Jsoniter 功能多多,文档以例子为主。你剋有看到很多代码示例来演示这些常用任务如何实现
70+
Jsoniter 功能多多,文档以例子为主。有很多代码示例来演示这些常用任务如何实现
7171

7272
* [如何在 Android 平台上使用](http://jsoniter.com/java-features.html#performance-is-optional)
7373
* [如何检查 JSON 中是否包含指定属性](http://jsoniter.com/java-features.html#validation)

0 commit comments

Comments
 (0)