We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0f06ba2 commit 65528e9Copy full SHA for 65528e9
go-tips.cn.md
@@ -119,6 +119,17 @@ json.Marshal(struct{
119
```
120
121
# 用字符串传递数字
122
+
123
+```golang
124
+type TestObject struct {
125
+ Field1 int `json:",string"`
126
+}
127
+```
128
129
+这个对应的json是 `{"Field1": "100"}`
130
131
+如果json是 `{"Field1": 100}` 则会报错
132
133
# 容忍字符串和数字互转
134
# 容忍空数组作为对象
135
# 使用 MarshalJSON支持time.Time
0 commit comments