Jeffail/gabs

Path/Search does not work with arrays

squillace91 opened this issue · 2 comments

The example given in the readme also does work. This is what I get when trying to run the example.

image

Are you using github.com/Jeffail/gabs/v2? It seems to work fine for me:

package main

import (
	"github.com/Jeffail/gabs/v2"
)

func main() {
	jsonParsed, err := gabs.ParseJSON([]byte(`{"array":[{"value":1},{"value":2},{"value":3}]}`))
	if err != nil {
		panic(err)
	}
	val := jsonParsed.Path("array.1.value").String()
	if val != "2" {
		panic(val)
	}
}

Hey @mihaitodor,

You are right, on v2 that does work. I apologize. I already had the library installed so didn't see the new version.