stretchr/objx

Unable to get value of nested []interface{} type

tjasko opened this issue · 0 comments

Given the following JSON:

{"values":[["test"]]}

Attempting to get the value of "test" via the values[0][0] path fails.

Example program:

package main

import (
	"fmt"
	"github.com/stretchr/objx"
)

func main() {	
	d := objx.MustFromJSON(`{"values":[["test"]]}`)

	// Returns "[]interface {}{"test"}".
	fmt.Println(d.Get("values[0]").String())
	
	// Returns empty string.
	fmt.Println(d.Get("values[0][0]").String())
}

The expected result would be for d.Get("values[0][0]").String() to return test.