golang simplejson 使用笔记

前端之家收集整理的这篇文章主要介绍了golang simplejson 使用笔记前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
第一步,得到json的内容
contents,_ := IoUtil.ReadAll(res.Body)
js,js_err := simplejson.NewJson(contents)

第二部,根据json的格式,选择使用array或者map储存数据
var nodes = make(map[string]interface{})
nodes,_ = js.Map()

第三步,将nodes当作map处理即可,如果map的value仍是一个json机构,回到第二步。
for key,_ := range nodes {
...
}
原文链接:https://www.f2er.com/go/190492.html

猜你在找的Go相关文章