-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
package main
import (
"fmt"
"code.cloudfoundry.org/jsonry"
)
func main() {
data := `{"nfs":[{"volume_mounts":[{"container_dir":"foo"}]}]}`
var receiver struct {
Paths []string `jsonry:"nfs.volume_mounts.container_dir"`
}
if err := jsonry.Unmarshal([]byte(data), &receiver); err != nil {
panic(err)
}
fmt.Printf("%+v", receiver.Paths)
}You'd expect this to extract the string foo, but it panics with:
panic: cannot unmarshal "[foo]" type "[]interface {}" into index 0 (type "string") path Paths[0]
Metadata
Metadata
Assignees
Labels
No labels