Go Noob here, confused about struct. My result is type []gjson.Result but I can't extract a named value from this struct. Help greatly appreciated, I have tried several articles.
package main import ( "fmt" "github.com/tidwall/gjson" "reflect" ) func main() { // JSON package gjson const json = `{"pass":true,"balance":180,"who":"f","ID":4231}]` jsonvals := gjson.GetMany(string(json), "pass", "balance", "ID") fmt.Printf("%+v\n", jsonvals) // result: [true 180 4231] fmt.Println(reflect.TypeOf(jsonvals)) // result: []gjson.Result fmt.Printf("\n%+v\n", jsonvals.ID) // fails here, why? it is a struct, right??? } -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.