【笔记】Go语言操作JSON格式字符串
前言
GJSON is a Go package that provides a fast and simple way to get values from a json document. It has features such as one line retrieval, dot notation paths, iteration, and parsing json lines.(Github)
不进行JSON转对象而直接通过对象的方式操作JSON格式字符串中的数据
下载依赖
1 | go get -u github.com/tidwall/gjson |
引入依赖
1 | import "github.com/tidwall/gjson" |
获取JSON格式字符串中的数据
1 | const json = `{"key": {"k": "v"}}` |