@@ -256,7 +256,7 @@ decoder1.Decode(&obj1)
256
256
should.Equal (json.Number (" 123" ), obj1)
257
257
```
258
258
259
- jsoniter 支持标准库的这个用法。同时,扩展了行为使得 Unmarshal 也可以支持 UseNumber 了。
259
+ jsoniter support this usage. And it extended the support to ` Unmarshal ` as will.
260
260
261
261
``` golang
262
262
json := Config {UseNumber:true }.Froze ()
@@ -265,9 +265,9 @@ json.UnmarshalFromString("123", &obj)
265
265
should.Equal (json.Number (" 123" ), obj)
266
266
```
267
267
268
- # 统一更改字段的命名风格
268
+ # Field naming strategy
269
269
270
- 经常 JSON 里的字段名 Go 里的字段名是不一样的。我们可以用 field tag 来修改。
270
+ Most of the time, we want to different field names in JSON. We can use field tag:
271
271
272
272
``` golang
273
273
output , err := jsoniter.Marshal (struct {
@@ -280,7 +280,7 @@ output, err := jsoniter.Marshal(struct {
280
280
should.Equal (` {"user_name":"taowen","first_language":"Chinese"}` , string (output))
281
281
```
282
282
283
- 但是一个个字段来设置,太麻烦了。如果使用 jsoniter,我们可以统一设置命名风格。
283
+ However, it is tedious. If you are using jsoniter, we can change all fields in one line.
284
284
285
285
``` golang
286
286
import " github.com/json-iterator/go/extra"
@@ -297,9 +297,9 @@ should.Nil(err)
297
297
should.Equal (` {"user_name":"taowen","first_language":"Chinese"}` , string (output))
298
298
```
299
299
300
- # 使用私有的字段
300
+ # Private fields
301
301
302
- Go 的标准库只支持 public 的 field。jsoniter 额外支持了 private 的 field。需要使用 ` SupportPrivateFields() ` 来开启开关。
302
+ The standard library requries all fields appear in JSON to be public. If you use jsoniter, ` SupportPrivateFields() ` will remove this restriction.
303
303
304
304
``` golang
305
305
import " github.com/json-iterator/go/extra"
0 commit comments