func (p *Paved) GetValueInto(path string, out interface{}) error {
	val, err := p.GetValue(path)
	if err != nil {
		return err
	}
	js, err := json.Marshal(val)
	if err != nil {
		return errors.Wrap(err, "cannot marshal value to JSON")
	}
	return errors.Wrap(json.Unmarshal(js, out), "cannot unmarshal value from JSON")
}
GetValueInto the supplied type.
package fieldpath
import (
	"strconv"
	"k8s.io/apimachinery/pkg/runtime"
	"k8s.io/apimachinery/pkg/util/json"
	"github.com/crossplane/crossplane-runtime/pkg/errors"
)
type errNotFound struct {
	error
}
func (e errNotFound) IsNotFound() bool {
	return true
}
func IsNotFound(err error) bool {
	cause := errors.Cause(err)
	_, ok := cause.(interface {
		IsNotFound() bool
	})
	return ok
}
type Paved struct {
	object map[string]interface{}
}
func PaveObject(o runtime.Object) (*Paved, error) {
	u, err := runtime.DefaultUnstructuredConverter.ToUnstructured(o)
	return Pave(u), errors.Wrap(err, "cannot convert object to unstructured data")
}
func Pave(object map[string]interface{}) *Paved {
	return &Paved{object: object}
}
func (p Paved) MarshalJSON() ([]byte, error) {
	return json.Marshal(p.object)
}
func (p *Paved) UnmarshalJSON(data []byte) error {
	return json.Unmarshal(data, &p.object)
}
func (p *Paved) UnstructuredContent() map[string]interface{} {
	if p.object == nil {
		return make(map[string]interface{})
	}
	return p.object
}
func (p *Paved) SetUnstructuredContent(content map[string]interface{}) {
	p.object = content
}
func (p *Paved) getValue(s Segments) (interface{}, error) {
	return getValueFromInterface(p.object, s)
}
func getValueFromInterface(it interface{}, s Segments) (interface{}, error) {
	for i, current := range s {
		final := i == len(s)-1
		switch current.Type {
		case SegmentIndex:
			array, ok := it.([]interface{})
			if !ok {
				return nil, errors.Errorf("%s: not an array", s[:i])
			}
			if int(current.Index) >= len(array) {
				return nil, errNotFound{errors.Errorf("%s: no such element", s[:i+1])}
			}
			if final {
				return array[current.Index], nil
			}
			it = array[current.Index]
		case SegmentField:
			object, ok := it.(map[string]interface{})
			if !ok {
				return nil, errors.Errorf("%s: not an object", s[:i])
			}
			v, ok := object[current.Field]
			if !ok {
				return nil, errNotFound{errors.Errorf("%s: no such field", s[:i+1])}
			}
			if final {
				return v, nil
			}
			it = object[current.Field]
		}
	}
	return nil, nil
}
func (p *Paved) ExpandWildcards(path string) ([]string, error) {
	segments, err := Parse(path)
	if err != nil {
		return nil, errors.Wrapf(err, "cannot parse path %q", path)
	}
	segmentsArray, err := expandWildcards(p.object, segments)
	if err != nil {
		return nil, errors.Wrapf(err, "cannot expand wildcards for segments: %q", segments)
	}
	paths := make([]string, len(segmentsArray))
	for i, s := range segmentsArray {
		paths[i] = s.String()
	}
	return paths, nil
}
func expandWildcards(data interface{}, segments Segments) ([]Segments, error) {  
	var res []Segments
	it := data
	for i, current := range segments {
		if current.Type == SegmentField && current.Field == wildcard {
			switch mapOrArray := it.(type) {
			case []interface{}:
				for ix := range mapOrArray {
					expanded := make(Segments, len(segments))
					copy(expanded, segments)
					expanded = append(append(expanded[:i], FieldOrIndex(strconv.Itoa(ix))), expanded[i+1:]...)
					r, err := expandWildcards(data, expanded)
					if err != nil {
						return nil, errors.Wrapf(err, "%q: cannot expand wildcards", expanded)
					}
					res = append(res, r...)
				}
			case map[string]interface{}:
				for k := range mapOrArray {
					expanded := make(Segments, len(segments))
					copy(expanded, segments)
					expanded = append(append(expanded[:i], Field(k)), expanded[i+1:]...)
					r, err := expandWildcards(data, expanded)
					if err != nil {
						return nil, errors.Wrapf(err, "%q: cannot expand wildcards", expanded)
					}
					res = append(res, r...)
				}
			default:
				return nil, errors.Errorf("%q: unexpected wildcard usage", segments[:i])
			}
			return res, nil
		}
		var err error
		it, err = getValueFromInterface(data, segments[:i+1])
		if IsNotFound(err) {
			return nil, nil
		}
		if err != nil {
			return nil, err
		}
	}
	return append(res, segments), nil
}
func (p *Paved) GetValue(path string) (interface{}, error) {
	segments, err := Parse(path)
	if err != nil {
		return nil, errors.Wrapf(err, "cannot parse path %q", path)
	}
	return p.getValue(segments)
}