func (t *Traversal) TraverseJSON() (interface{}, error) {
	return t.traverseJSON(t.document, "")
}
TraverseJSON performs a traverse of JSON document and applying
action for each JSON element
package json_utils
import (
	"fmt"
	"strconv"
	"github.com/kyverno/kyverno/pkg/engine/common"
)
type ActionData struct {
	Document interface{}
	Element  interface{}
	Path     string
}
type Action func(data *ActionData) (interface{}, error)
func OnlyForLeafsAndKeys(action Action) Action {
	return func(data *ActionData) (interface{}, error) {
		switch typed := data.Element.(type) {
		case map[string]interface{}, []interface{}:  
			return data.Element, nil
		case Key:
			data.Element = typed.Key
			return action(data)
		default:  
			return action(data)
		}
	}
}
type Traversal struct {
	document interface{}
	action   Action
}
func NewTraversal(document interface{}, action Action) *Traversal {
	return &Traversal{
		document,
		action,
	}
}
type Key struct {
	Key string
}