GO语言常见包的操作之json(1)
来源:互联网 发布:tensorflow tutorial 编辑:程序博客网 时间:2024/06/06 15:37
package mainimport ("encoding/json""log")type Student struct {StudentId string `json:"studentId"`StudentName string `json:"studentName"`StudentAddress string `json:"studentAddress"`}func structToJosn() {student := Student{StudentId: "20134300",StudentName: "Jack",StudentAddress: "American",}buf, err := json.Marshal(student)if err != nil {log.Println(err)}log.Printf("json student %s \n", string(buf))}func structsToJosn() {students := []Student{{StudentId: "20134300",StudentName: "Jack",StudentAddress: "American",},{StudentId: "20134301",StudentName: "Mack",StudentAddress: "American",},}buf, err := json.Marshal(students)if err != nil {log.Println(err)}log.Printf("json student %s \n", string(buf))}func main() {structToJosn()structsToJosn()}
0 0
- GO语言常见包的操作之json(1)
- Go语言操作json
- Go语言操作json
- Go语言学习之os包中文件相关的操作(The way to go)
- go语言之json的使用
- go语言json操作指南
- Go语言学习之encoding/json包(The way to go)
- Go语言之JSON处理
- Go语言学习之net/url包(url相关操作)(the way to go)
- go语言的常见函数
- go语言的http包
- Go语言的os包
- 九、Go语言库之strconv包--GO语言笔记
- Go语言学习之JSON RPC
- Go 语言标准库之 strings包
- go语言学习之gzip包解读
- GO语言的mysql操作
- GO语言的"类"操作
- 用原生js实现距离今年年底倒计时效果
- leetcode-347-Top K Frequent Elements
- 朴素贝叶斯用到的概率公式
- java及spring框架笔记
- 【HNOI2013】游走
- GO语言常见包的操作之json(1)
- C++模板之Vector与STL初探
- gvim安装和配置
- ApkProvisionException问题解决
- 观察者模式
- Linux下进程描述(1)—进程控制块
- PHP socket服务器框架Workerman (GatewayWorker)
- 摄像机摇移跟随
- Redis安装