美文网首页
golang处理多层json

golang处理多层json

作者: heliping_peter | 来源:发表于2021-10-09 17:46 被阅读0次

接口返回的json文件

{"success":true,"message":null,"data":{"maxUsers":"4000","avgThroughput":"1690.27","errors":"100.0000","avgResponseTime":"6.0109","responseTime90":"6.0120","avgBandwidth":"796.45","avgTransactions":"426.55"}}

使用golang解析data内部的数据

       var tmpresult map[string]interface{} 
    json.Unmarshal(content, &tmpresult)
    data := tmpresult["data"].(map[string]interface {})
    maxUsers := data["maxUsers"]

相关文章

网友评论

      本文标题:golang处理多层json

      本文链接:https://www.haomeiwen.com/subject/janqoltx.html