项目地址:
https://github.com/alibaba/jsonq
示例json
{ "foo": 1, "bar": 2, "test": "Hello, world!", "baz": 123.1, "array": [ {"foo": 1}, {"bar": 2}, {"baz": 3} ], "subobj": { "foo": 1, "subarray": [1,2,3], "subsubobj": { "bar": 2, "baz": 3, "array": ["hello", "world"] } }, "bool": true }
调用
import ( "strings" "encoding/json" "github.com/jmoiron/jsonq" ) data := map[string]interface{}{} dec := json.NewDecoder(strings.NewReader(jsonstring)) dec.Decode(&data) jq := jsonq.NewQuery(data)
有疑问加站长微信联系(非本文作者)