Skip to content

Commit a9e40f1

Browse files
authored
Update index.cn.md
1 parent 53c80a5 commit a9e40f1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

index.cn.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ jsoniter(json-iterator)是一款快且灵活的 JSON 解析器,同时提
1010
* Jsoniter 是最快的 JSON 解析器。它最多能比普通的解析器快10倍之多,即使在数据绑定的用法下也有同样的性能优势。无耻地献上自己的 [跑分](/benchmark.html)
1111
* 非常易于使用的 api,允许你使用任何风格或者混搭的方式来解析 JSON。给你前所未有的灵活性。来看看这些 [API们](/api.html) 是不是真的有那么好用吧
1212
* 独特的 iterator api 能够直接遍历 JSON,极致性能!0 内存分配!这样的 [iterator](/api.html#iterator-api) 你绝对没有用过
13+
* 数据绑定的每一个步骤都可以被定制,参见 [java](/java-extension.html)[go](/go-extension.html) 版本的扩展文档。
1314

1415
# 自卖自夸
1516

@@ -36,6 +37,23 @@ int[] val = iter.read(int[].class);
3637
System.out.println(val[3]);
3738
```
3839

40+
可以把数据直接绑定到已有的对象上
41+
42+
```java
43+
public static class TestObj1 {
44+
public String field1;
45+
public String field2;
46+
}
47+
48+
TestObj1 testObj = new TestObj1();
49+
testObj.field2 = "world";
50+
JsonIterator iter = JsonIterator.parse("{ 'field1' : 'hello' }".replace('\'', '"'));
51+
iter.read(testObj);
52+
53+
System.out.println(testObj.field1); // "hello"
54+
System.out.println(testObj.field2); // "world"
55+
```
56+
3957
使用 Go bind-api
4058

4159
```go

0 commit comments

Comments
 (0)