Empty result in "SELECT"
cryptomatictrader opened this issue · 1 comments
cryptomatictrader commented
I get empty result in the following code but it works fine if I use "FIND" instead of "SELECT". Any idea why?
package main
import (
"fmt"
gojsonq "github.com/thedevsaddam/gojsonq/v2"
)
func main() {
const json = `{"name":{"first":"Tom","last":"Hanks"},"age":61}`
jq := gojsonq.New().FromString(json).Select("name")
fmt.Printf("%#v\n", jq.Get())
}
thedevsaddam commented
While using Get
please use From
method to select a start point
const json = `{"name":{"first":"Tom","last":"Hanks"},"age":61}`
jq := gojsonq.New().FromString(json)
fmt.Printf("%#v\n", jq.From("name").Get())