您当前的位置: 首页 >  json

衣舞晨风

暂无认证

  • 4浏览

    0关注

    1156博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Go 结构体 Json 互转

衣舞晨风 发布时间:2017-11-15 19:22:49 ,浏览量:4

1、结构体转Json

jsons, errs := json.Marshal(cert)
if errs != nil {
    fmt.Println(errs.Error())
}
fmt.Println(string(jsons))

2、Json转结构体 ··· cert1 := new(lbv1alpha1.Cert) json.Unmarshal([]byte(jsons), &cert1)//json解析到结构体里面 fmt.Println(cert1) ···

需要引用的包:

···

encoding/json

···

个人微信公众号: 这里写图片描述

作者:jiankunking 出处:http://blog.csdn.net/jiankunking

关注
打赏
1647422595
查看更多评论
立即登录/注册

微信扫码登录

0.0505s