Golang 版 json to go
Caddy 的作者 Matt Holt
用 js 写了一个小工具 json to go
可以方便的把 json 字符串转为go struct
现在好事者就用 go 来实现相同的转换功能
package main
import (
"github.com/kumakichi/json-to-go"
)
func main() {
println(json_to_go.Parse(testData))
println(json_to_go.Parse(testData, json_to_go.Options{TypeName: "rootName", Flatten: true}))
}
var (
testData = `{
"name": {"first": "Tom", "last": "Anderson"},
"age":37,
"score": 92.0,
"children": ["Sara","Alex","Jack"],
"friends": [
{"first": "James", "last": "Murphy"},
{"first": "Roger", "last": "Craig"}
]
}`
)
- js JSON-to-Go https://mholt.github.io/json-to-go/
- go JSON-to-Go https://github.com/kumakichi/json-to-go
还其它很有用的工具
- curl-to-go https://github.com/mholt/curl-to-go
- http-to-curl https://github.com/moul/http2curl
0
See Also
- golang 在中国最受欢迎
- 把JSON数据转为Go struct
- go+json 还是没有python+json 结合得完美,解析速度比python 慢
- Golang leveldb 热备份方法
- Golang boltdb 与 leveldb 的读写性能比较
Nearby
- 上一篇 › 宽屏样式问题
- 下一篇 › 管理员也没法删评论吗?~