Path/Search does not work with arrays
squillace91 opened this issue · 2 comments
squillace91 commented
mihaitodor commented
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)
}
}
squillace91 commented
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.