thedevsaddam / gojsonq

A simple Go package for querying over JSON, YAML, XML, and CSV data.
https://github.com/thedevsaddam/gojsonq/wiki
MIT License
2.19k stars 140 forks source link

Support for `Result` method #61

Closed thedevsaddam closed 5 years ago

thedevsaddam commented 5 years ago

Result will return static type instead of interface.

const json = `{"name":{"first":"Tom","last":"Hanks"},"age":61}`
result, err := gojsonq.New().JSONString(json).FindR("name.first")
if err != nil {
    log.Fatal(err)
}
name, _ := result.String()
fmt.Println(name)

Result may contains method like: String/Int/Int32/Int64/Uint/Uint32/Uint64/Float32/Float64/[]String/[]Int/[]Uint/[]Float32 etc method

Result method name may FindR/GetR etc