thedevsaddam/gojsonq

Empty result in "SELECT"

cryptomatictrader opened this issue · 1 comments

I get empty result in the following code but it works fine if I use "FIND" instead of "SELECT". Any idea why?

See this in Go Playground

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())
}

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())