The `EachKey` API does not work coherently to the `Get` one w.r.t array of strings. Meaning that it does not work on paths like "request>headers>User-Agent>[0]", while `Get` does. Here's a minimal reproducer: ```go package main import ( "fmt" "github.com/buger/jsonparser" ) func main() { data := []byte(`{"request":{"headers":{"User-Agent":["abc"]}}}`) paths := [][]string{ []string{"request", "headers", "User-Agent", "[0]"}, } jsonparser.EachKey(data, func(idx int, val []byte, typ jsonparser.ValueType, err error) { fmt.Printf("NO: val: %s / typ: %s / err: %s\n", val, typ, err) }, paths...) v, t, _, e := jsonparser.Get(data, paths[0]...) fmt.Printf("OK: val: %s / typ: %s / err: %s\n", v, t, e) } ``` As you can see in the output `EachKey` fails while `Get` doesn't: ```console NO: val: / typ: unknown / err: Unknown value type OK: val: abc / typ: string / err: %!s(<nil>) ```
Activity
fix: workaround to fix the indexing of array of strings not working
fix: workaround to fix the indexing of array of strings not working
cedecegreen commentedon May 24, 2022
this issue may be a duplicate of #180
v1.3.1: fix Set aliasing (buger#209/buger#141), EachKey array-index (b…